【发布时间】:2012-06-13 15:14:33
【问题描述】:
所以我试图将从 UIImagePickerController 获取的图像保存到 NSUserDefaults 以便我可以在我生成的相册中打开它,但是当我调用委托方法来保存图片时,我收到错误:
[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '<UIImage: 0x1d0bf0>' of class 'UIImage'. Note that dictionaries and arrays in property lists must also contain only property values.`
代码如下:
self.savedPic = [[UIImage alloc] init];
self.savedPic = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[[NSUserDefaults standardUserDefaults] setValue:self.savedPic forKey:[NSString stringWithFormat:@"image_%i",imageCount]];
【问题讨论】:
标签: objective-c uiimagepickercontroller nsuserdefaults