Store NSMutableArray in NSUserDefaults

I am trying to save NSMutableArray

in the NSUserDefaults

following way but I get the following error.

(lldb) po pOrderElements
<__NSArrayM 0x174256b90>(
{
    category = 1;
    imagePath = "products/chicken-kabob.png";
    name = "Baked Chicken";
    price = "5.49";
}
)

NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:pOrderElements forKey:@"tableViewData"];
[userDefaults synchronize];

      

Application terminated due to uncaught exception "NSInvalidArgumentException", reason: "Attempt to insert a non-proprietary list of objects ({category = 1; id =" "; imagePath =" products / chicken-kabob.png "; name =" Baked chicken " ; price = "5.49";}) for tableViewData '

0
ios objective-c nsmutablearray nsuserdefaults


source to share


No one has answered this question yet

See similar questions:

175
Attempting to set a non-property-list object as NSUserDefaults
1
Save custom objects to NSUserDefaults

or similar:

1244
How can I sort NSMutableArray with custom objects in it?
281
Clearing NSUserDefaults
261
How to save custom objects to NSUserDefaults
33
Trying to insert a list of objects object without saving when trying to save a custom object in Swift 3
1
Find out which object is being added to NSMutableArray is null
0
(Application terminated due to unmapped exception "NSInvalidArgumentException)
0
Saving NSKeyedArchiver to NSUserDefaults doesn't work ...
0
Storing NSMutableArray populated with custom objects in NSUserDefaults - failure
0
NSInvalidArgumentException to save array of custom objects to UserDefaults
-2
What am I doing wrong with these NSMutableArray structures in NSUserDefaults? msgstr "trying to insert a list object without a property"



All Articles
Loading...
X
Show
Funny
Dev
Pics