基本上我有一系列我想要存储在NSUserDefaults中的NSdictionaries。 pageDict是一个本地NSDictionary LyteData是一个用于存储东西的Singleton类 层次结构来自lyteData.textbookDictArray ---> lyteData.pagesDictArray ---> pageDict(NSDictionary)
[pageDict setObject:textbookImage forKey:@"image"];
[pageDict setObject:textbookName forKey:@"name"];
[pageDict setObject:page forKey:@"page"];
[pageDict setObject:nameOfClass forKey:@"class"];
LyteData *lyteData = [LyteData sharedManager];
[lyteData.pagesDictArray addObject:pageDict];
[lyteData.textbookDictArray addObject:lyteData.pagesDictArray];
NSLog(@"array: %@", lyteData.pagesDictArray);
NSLog(@"textbook array: %@", lyteData.textbookDictArray);
//THIS CODE IS FOR SAVING THE ARRAY OF TEXTBOOKS AS USERDEFAULT
[[NSUserDefaults standardUserDefaults]
setObject:lyteData.textbookDictArray forKey:@"textbookArray"];
我收到此错误:
Attempt to set a non-property-list object (
{
class = hb;
image = "<UIImage: 0x165c43d0>";
name = fv;
page = 25;
}
) as an NSUserDefaults value for key textbookArray
如何在NSUserDefaults中存储该数组?