【发布时间】:2012-04-19 09:57:29
【问题描述】:
我有一个应用程序,可以将图像存储到 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];
}];
}
在我的 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]);
}
}];
}
但我的应用程序不断崩溃 帮帮我 提前致谢
【问题讨论】:
-
关于 NSLog 的声明
-
发送到实例的无法识别的选择器
-
请告诉您完整的崩溃日志...
-
*** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[ALAssetsLibrary saveImage:toAlbum:withCompletionBlock:]: 无法识别的选择器发送到实例 0x8eafb60”
标签: iphone objective-c alassetslibrary