Waa*_*han 5 iphone objective-c alassetslibrary
我有一个应用程序将图像存储到iphone中相册中的自定义库.
我调用了ALAssetLibrary的以下函数
-(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];
}];
}
Run Code Online (Sandbox Code Playgroud)
在我的SaveImage IBAction中
-(IBAction)saveToLib:(id)sender
{
UIImage *savedImage = imgPicture.image;
NSLog(@"Saved Image%@",savedImage);
[self.library saveImage:savedImage toAlbum:@"Touch Code" withCompletionBlock:^(NSError *error) {
if (error!=nil) {
NSLog(@"Big error: %@", [error description]);
}
}];
}
Run Code Online (Sandbox Code Playgroud)
但我的应用程序不断崩溃帮我解决,谢谢你提前
| 归档时间: |
|
| 查看次数: |
2809 次 |
| 最近记录: |