Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将CR2/NEF/RAW图像保存到照相/摄像卷中的相册(IOS)_Ios_Objective C_Ios10 - Fatal编程技术网

如何将CR2/NEF/RAW图像保存到照相/摄像卷中的相册(IOS)

如何将CR2/NEF/RAW图像保存到照相/摄像卷中的相册(IOS),ios,objective-c,ios10,Ios,Objective C,Ios10,我有一张CR2图像(由佳能数码单反拍摄)保存在沙盒中,我想把它添加到相机卷中。所以我使用下面的方法,但它会导致错误,没有描述。如何将CR2保存到相机卷?非常感谢 [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ // Request creating an asset from the image. PHAssetChangeRequest *createAssetRequest = [PHAssetChangeRequ

我有一张CR2图像(由佳能数码单反拍摄)保存在沙盒中,我想把它添加到相机卷中。所以我使用下面的方法,但它会导致错误,没有描述。如何将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));
    }];
[[PHPhotoLibrary sharedPhotoLibrary]性能更改:^{
//请求从映像创建资源。
PHAssetChangeRequest*createAssetRequest=[PhasSetChangeRequestCreationRequestForAssetFromImageAtFileURL:[NSURL URLWithString:localPath]];
//请求编辑相册。
PHFetchResult*albumList=[PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum子类型:PHAssetCollectionSubtypeSmartAlbumUserLibrary选项:nil];
相册;
用于(相册列表中的PHAssetCollection*am){
if([am.localizedTitle IsequalString:ALBUMN]){
相册=am;
}
}
PHAssetCollectionChangeRequest*albumChangeRequest=[PhasSetCollectionChangeRequestChangeRequestForAssetCollection:album];
//获取新资源的占位符并将其添加到唱片集编辑请求中。
PHObjectPlaceholder*assetPlaceholder=[createAssetRequest占位符用于CreateDasset];
[AlbumChangeRequestAddAssets:@[assetPlaceholder];
}completionHandler:^(布尔成功,N错误*错误){
NSLog(@“-=-=-=-已完成添加资产%@),(成功?@“成功”:错误);
}];
输出消息状态:ImageIO:pluginformouttype:316:文件格式“com.canon.cr2 raw image”不支持写入