在 swift 中使用 `NSDictionary` 时出错
Error using `NSDictionary` in swift
我是 swift 的新手,我正在尝试在集合视图中显示图像集合
我收到此代码的错误
let asset: PHAsset = self.photoAsset[indexPath.item] as PHAsset
PHImageManager.defaultManager().requestImageForAsset(asset, targetSize: PHImageManagerMaximumSize, contentMode: .ScaleAspectFill, options: nil, resultHandler: {
(result: UIImage!, info: NSDictionary!)in cell.setThumbnailImage(result)
})
'[NSObject : AnyObject]' is not identical to 'NSDictionary'
是错误,我不知道如何解决?
帮助说
func requestImageForAsset(_ asset: PHAsset!,
targetSize targetSize: CGSize,
contentMode contentMode: PHImageContentMode,
options options: PHImageRequestOptions!,
resultHandler resultHandler: ((UIImage!,
[NSObject : AnyObject]!) -> Void)!) -> PHImageRequestID
你提供
info: NSDictionary!
更改它以便您提供
info: [NSObject : AnyObject]!
我是 swift 的新手,我正在尝试在集合视图中显示图像集合
我收到此代码的错误
let asset: PHAsset = self.photoAsset[indexPath.item] as PHAsset
PHImageManager.defaultManager().requestImageForAsset(asset, targetSize: PHImageManagerMaximumSize, contentMode: .ScaleAspectFill, options: nil, resultHandler: {
(result: UIImage!, info: NSDictionary!)in cell.setThumbnailImage(result)
})
'[NSObject : AnyObject]' is not identical to 'NSDictionary'
是错误,我不知道如何解决?
帮助说
func requestImageForAsset(_ asset: PHAsset!,
targetSize targetSize: CGSize,
contentMode contentMode: PHImageContentMode,
options options: PHImageRequestOptions!,
resultHandler resultHandler: ((UIImage!,
[NSObject : AnyObject]!) -> Void)!) -> PHImageRequestID
你提供
info: NSDictionary!
更改它以便您提供
info: [NSObject : AnyObject]!