I want to save My Data Type temporary in NSUserDefault. this data later pull back.
I tried to following code.
MyObject *myObject = [[MyObject alloc] init];
[[NSUserDefaults standardUserDefaults] setObject:myObject forKey:@"kMyObject"];
but console show to text me following message.
-[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '<MyObject: 0x4aadb0>' of class 'MyObject'. Note that dictionaries and arrays in property lists must also contain only property values.
I can ignore these messages and to force pull out from NSUserDefault.
MyObject *getObject = [[NSUserDefaults standardUserDefaults] objectForKey:@"kMyObject"];
but, not give back original data. (I've Checked the NSLog, returns Null.)
How to solve this problem? I only prefer save to NSUserDefaults. not recommended to me using CoreData.