正如标题所说,我试图在用户默认设置一个NSDictionary节省一些UIImages在它:保存的NSDictionary与UIImage的用户默认
UIImage* img = PhotoView.image;
NSMutableDictionary *UserInfoDictionary = [[NSMutableDictionary alloc] init];
[UserInfoDictionary setObject:img forKey:@"ProfileImage"];
[UserInfoDictionary setObject:ProfileUsername.text forKey:@"Username"];
[[NSUserDefaults standardUserDefaults] setObject:UserInfoDictionary forKey:@"ProfileAndFolderInformation"];
可能有最多30幅添加到字典,但现在的应用程序崩溃的错误:
Attempt to set a non-property-list object {
ProfileImage = "<UIImage: 0x16dc4280>";
} as an NSUserDefaults value for key ProfileAndFolderInformation
2013-11-23 21:39:00.261 Cleverly[363:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSUserDefaults setObject:forKey:]: attempt to insert non-property list object {
ProfileImage = "<UIImage: 0x16dc4280>";
} for key ProfileAndFolderInformation'
*** First throw call stack:
(0x30b59e83 0x3aeba6c7 0x30b59dc5 0x3148aa91 0xbaad9 0x33312da3 0x33312d3f 0x33312d13 0x332fe743 0x3331275b 0x33312425 0x3330d451 0x332e2d79 0x332e1569 0x30b24f1f 0x30b243e7 0x30b22bd7 0x30a8d471 0x30a8d253 0x357c12eb 0x33342845 0x9bb7d 0x3b3b3ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
它甚至可以存储用户默认图像?