PHAssetCollectionChangeRequest: addAssets () now accepts NSFastEnumeration. how to achieve this?

enter image description here

My Application is trying to import an image from photos and add it to an album.

But in the recent quick changes. addAssets () takes a parameter as NSFastEnumeration. Therefore, I get an error message as shown.

even the Apple API document has the same code: https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAssetChangeRequest_Class/index.html#//apple_ref/occ/instp/PHAssetChangeRequest/placeholderForCreatedAsset

What is the alternative or how can I add Assets now?

+6
source share
1 answer

So, I did some research, and according to NSHipster , NSEnumeration is a protocol implemented by NSArray , NSSet and NSDictionary . This suggests that if you convert [assetPlaceholder] to NSArray , you can use it in the method. And, in fact, this compiles:

 let enumeration: NSArray = [assetPlaceholder!] albumChangeRequest!.addAssets(enumeration) 
+13
source

Source: https://habr.com/ru/post/989057/


All Articles