gpt4 book ai didi

ios - 不响应选择器图像:didFinishSavingWithError:contextInfo:

转载 作者:行者123 更新时间:2023-12-01 17:57:34 25 4
gpt4 key购买 nike

谢谢您的阅读,这是我的问题。
我正在尝试保存图片(使用UIImagePickerController方法拍摄的图片),但是出现错误。错误为“不响应选择器图像:didFinishSavingWithError:contextInfo :)

我在其他地方读过,这与将实例方法更改为类方法有关(但是我是菜鸟,不知道这意味着什么。)这是我的代码:D。

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {



// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

// Save image
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
}

有人告诉我,这与UIImageWriteToSavedPhotosAlbum方法中的“Self”有关。

最佳答案

使用此代码保存您选择的图像:

 -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
UIImageWriteToSavedPhotosAlbum(image,self,
@selector(image:finishedSavingWithError:contextInfo:),
nil);
}

并添加此功能。
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo: (void *)contextInfo
{
if (error != nil)
{
NSLog(@"Image Can not be saved");
}
else
{
NSLog(@"Successfully saved Image");
}
}

关于ios - 不响应选择器图像:didFinishSavingWithError:contextInfo:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14576594/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com