alu*_*rd3 7 iphone image ios ios-simulator
我已经看到很多关于如何将图像添加到模拟器的问题,并且看到了两个答案:
两者都适用于iOS SDK 4.0之前的所有功能.那些相同的方法对我来说不再适用,也不适用于我见过的其他人.我试图使用我在某处找到的以下代码块手动将图像写入照片库:
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
UIAlertView *alert;
if (error) // Unable to save the image
alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Unable to save image to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
else // All is well
alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Image saved to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
[alert release];
}
Run Code Online (Sandbox Code Playgroud)
但每次都会出错.那么模拟器的写访问是一个问题吗?还是只是一些bug?我已经更新到iOS 4.1 SDK,希望它被修复,但事实并非如此.
Bin*_* Wu 16
我使用Xcode 3.2.4与SDK 3.2,4.0.1和4.1.以下步骤对我有用:1.启动模拟器2.将图像从Finder拖动到模拟器,模拟器将始终启动Safari以显示图像3.点击并按住该单击几秒钟,然后您将看到一个弹出窗口一个"保存图像"按钮