我在保存iOS应用程序中的笔画时遇到了一些麻烦。我已经成功地通过使用保存NSUserDefaults的文字在我的应用程序,但我不知道,如果保存图像以同样的方式,反正,这是我有:在iOS应用程序中保存
-(IBAction)saveImage:(id)sender
{
UIImage *saveImage = drawImage.image;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:saveImage forKey:@"image"];
[defaults synchronize];
}
每当我在我的应用程序打保存按钮(saveImage),Xcode的输出响应说, - [NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '<UIImage: 0x1f076ee0>' of class 'UIImage'
。
我不确定这是什么意思。 任何帮助将不胜感激,因为我是Xcode和Objective-C的新手。感谢您的帮助, -Karl。
我不认为你真的想保存用户默认图像。也许你想把它保存在文档文件夹中。 – pt2ph8