这可能是非常基本的,但我已经做了很多谷歌搜索,似乎无法弄清楚出了什么问题。我正在尝试将图像从 iOS 应用程序的沙盒数据文件夹移动到“相机胶卷”。
如果我使用UIImageWriteToSavedPhotosAlbum(img,nil,nil,nil),它不会引发错误,但也不会在照片中保存图像的副本。
为了弄清楚它失败的原因,我尝试实现一个选择器(如下),但现在它抛出一个 NSInvalidArgumentException,原因是“MyTest<...> 不响应选择器图像:didFinishSavingWithError:contextInfo:”
这是我的实现:
@implementation MyTest
- (void)
    image:(UIImage *) image
    didFinishSavingWithError: (NSError *) error
    contextInfo: (void *) contextInfo
{
    //log error or do stuff...
}
+ (void) moveToCameraRoll: (NSString *) path
{
    UIImage *img = [[UIImage imageNamed:path] retain];
    UIImageWriteToSavedPhotosAlbum(img,
                                   self,
                                   @selector(image:didFinishSavingWithError:contextInfo:),
                                   nil);
}
@end
我觉得这可能是非常基本的,但我一直无法找到答案。