How to save NSMutablearray in NSUserDefaults

前端 未结 9 1165
盖世英雄少女心
盖世英雄少女心 2020-11-29 17:50

I have two NSMutableArray\'s. They consist of images or text. The arrays are displayed via a UITableView. When I kill the app the data within the <

9条回答
  •  情歌与酒
    2020-11-29 18:17

    Save information of Array in NSUserdefaults with key.

    "MutableArray received from JSON response"

    [[NSUserDefaults standardUserDefaults] setObject:statuses forKey:@"arrayListing"];
    

    "Retrieve this information(Array) anywhere in the project with same key"

    NSArray *arrayList = [[NSUserDefaults standardUserDefaults] valueForKey:@"arrayListing"];
    

    This helped me in my project and hope, it will help someone.

提交回复
热议问题