我有一张保存在沙盒中的CR2图像(由佳能DSLR拍摄),我想将它添加到相机胶卷中。所以我使用下面的方法,但它导致错误,没有描述。如何将CR2保存到相机胶卷?非常感谢!
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
// Request creating an asset from the image.
PHAssetChangeRequest *createAssetRequest = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:[NSURL URLWithString:localPath]];
// Request editing the album.
PHFetchResult<PHAssetCollection *> *albumList = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary options:nil];
PHAssetCollection *album;
for(PHAssetCollection *am in albumList){
if([am.localizedTitle isEqualToString:ALBUMN]){
album = am;
}
}
PHAssetCollectionChangeRequest *albumChangeRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:album];
// Get a placeholder for the new asset and add it to the album editing request.
PHObjectPlaceholder *assetPlaceholder = [createAssetRequest placeholderForCreatedAsset];
[albumChangeRequest addAssets:@[assetPlaceholder]];
} completionHandler:^(BOOL success, NSError *error) {
NSLog(@"-=-=-=-Finished adding asset. %@", (success ? @"Success" : error));
}];
输出消息:ImageIO:PluginForUTType:316:文件格式'com.canon.cr2-raw-image'不支持写入