1

I'm trying save NSMutableDictionary in to NSUserDefaults. My code:

NSDictionary *command = [_otherVC.arrayCommandsAddComandVC objectAtIndex:indexPath.row];
NSString *commandID = [command objectForKey:@"id"];
[_otherVC.selectedCommands addObject:command];

NSMutableDictionary *commandPush = [[NSMutableDictionary alloc]initWithObjectsAndKeys:[NSNumber numberWithBool:1], @"news",
                                                                                     [NSNumber numberWithBool:1], @"articles",
                                                                                     [NSNumber numberWithBool:1], @"foto",
                                                                                     [NSNumber numberWithBool:1], @"video",
                                                                                     [NSNumber numberWithBool:1], @"matchStart",
                                                                                     [NSNumber numberWithBool:1], @"scoreChange",
                                                                                     [NSNumber numberWithBool:1], @"matchFinished", nil];
[_otherVC.settingsToPush setObject:commandPush forKey:commandID];

In other method i write to NSUserDefaults with helpers:

defaults_set_object_wo(@"settings/push/settings_to_push", _otherVC.settingsToPush);

And i have error:

Attempt to set a non-property-list object {
   1 =     {
       articles = 1;
       foto = 1;
       matchFinished = 1;
       matchStart = 1;
       news = 1;
       scoreChange = 1;
       video = 1;
   };
} as an NSUserDefaults value for key settings/push/settings_to_push
Jamie Taylor
  • 4,709
  • 5
  • 44
  • 66

0 Answers0