NSMserDefaults中的NSMutableDictionary“尝试设置非属性列表对象”

时间:2014-04-01 09:04:57

标签: nsuserdefaults nsmutabledictionary

我尝试将NSMutableDictionary保存到NSUserDefaults中。我的代码:

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];

在其他方法中,我使用帮助程序写入NSUserDefaults:

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

我有错误:

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

0 个答案:

没有答案