Mutable Objects inside NSUserDefaults

后端 未结 4 1284
说谎
说谎 2020-12-22 03:50

I created a simple database and put in NSUserDefaults. My database is NSMutableArray which has dictionaries and arrays inside in it. When I create NSMutableArray from NSUSer

4条回答
  •  忘掉有多难
    2020-12-22 04:28

    You can directly do by using method insertObject.

    In place of

    [[[arrayTwo objectAtIndex:0] objectForKey:@"itemlar"] addObject:@"hop"];
    

    use this,

    [arrayTwo insertObject:@"hop" atIndex:0];
    

    This will work for as i have tested it's also working finr after that you can make it as immutable object as NSARRAY and save it to NSUSERDEFAULTS.

提交回复
热议问题