简体   繁体   English

快速使用`NSDictionary`时出错

[英]Error using `NSDictionary` in swift

I'm very new to swift and im trying to display a collection of images in collection view 我是新手,我想尽快在收藏夹视图中显示一组图片

I get an error with this code 我收到此代码错误

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' is the error and I have no idea how to fix it? '[NSObject : AnyObject]' is not identical to 'NSDictionary'是错误,我不知道如何解决?

The help says 帮助说

func requestImageForAsset(_ asset: PHAsset!,
           targetSize targetSize: CGSize,
          contentMode contentMode: PHImageContentMode,
              options options: PHImageRequestOptions!,
        resultHandler resultHandler: ((UIImage!,
            [NSObject : AnyObject]!) -> Void)!) -> PHImageRequestID

and you supply 而你供应

info: NSDictionary!

Change it so you supply 更改它,以便您提供

info: [NSObject : AnyObject]!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM