0

I am trying to store NSMutableArray into NSUserDefaults as follows, but getting 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];

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Attempt to insert non-property list object ( { category = 1; id = ""; imagePath = "products/chicken-kabob.png"; name = "Baked Chicken"; price = "5.49"; } ) for key tableViewData'

casillas
  • 16,351
  • 19
  • 115
  • 215

0 Answers0