我尝试使用以下代码将图像放入自定义相册:
PHAssetCollection *album = [self getMyAlbum]; UIImage *image = [self getMyImage]; [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ PHAssetChangeRequest *createAssetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image]; PHObjectPlaceholder * placeHolder = createAssetRequest.placeholderForCreatedAsset; PHAssetCollectionChangeRequest *albumChangeRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:album]; if(placeHolder){ [albumChangeRequest addAssets:@[ placeHolder ]]; } } completionHandler:^(BOOL success, NSError *error) { //doesen't matter }];
因此,我在此行的用户日志中收到许多错误 createAssetRequest.placeholderForCreatedAsset
喜欢
1 CoreFoundation __exceptionPreprocess + 1245624
2 libobjc.A.dylib objc_exception_throw + 34136
3张照片__48- [PHChangeRequestHelper generateUUIDIfNecessary] _block_invoke + 116552
2 libdispatch.dylib _dispatch_semaphore_wait_slow + 79828
3张照片 - [PHChangeRequestHelper generateUUIDIfNecessary] + 115992
4张照片 - [PHAssetCreationRequest占位符ForCreatedAsset] + 244020
所以[PHChangeRequestHelper generateUUIDIfNecessary]
让我崩溃
我只在iOS> 10上看到这个,我无法在模拟器中重现这一点.
它是什么?如何解决?