【发布时间】:2015-04-18 14:53:53
【问题描述】:
我用AVfoundation 框架(目标C)创建了一个自定义相机,我正在使用
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
但它只是保存到默认相册。我想将我的照片保存在自定义相册中,但 ALAssetsLibrary 或 ALAssetsLibrary+CustomPhotoAlbum.h 不再与 iOS8 一起使用。我已经尝试了所有方法,但在 iOS8 中没有任何效果。
所以以下方法不起作用:
[self.library saveImage:image toAlbum:@"CustomAlbum" withCompletionBlock:^(NSError *error) {
if (error!=nil) {
NSLog(@"Big error: %@", [error description]);
}
}];
你能帮我把照片保存到iOS8的自定义相册吗?
非常感谢。
以下方法在 ALAssetsLibrary+CustomPhotoAlbum 中不起作用,在 iOS8 类中:
-(void)saveImage:(UIImage*)image toAlbum:(NSString*)albumName withCompletionBlock:(SaveImageCompletion)completionBlock
{
//write the image data to the assets library (camera roll)
[self writeImageToSavedPhotosAlbum:image.CGImage orientation:(ALAssetOrientation)image.imageOrientation
completionBlock:^(NSURL* assetURL, NSError* error) {
//error handling
if (error!=nil) {
completionBlock(error);
return;
}
//add the asset to the custom photo album
[self addAssetURL: assetURL
toAlbum:albumName
withCompletionBlock:completionBlock];
}];
}
【问题讨论】:
标签: ios xcode ios8 avfoundation