开发者

How do I load this array into memory

开发者 https://www.devze.com 2023-01-16 14:02 出处:网络
I saved an array using the following code: NSData *data = [NSKeyedArchiver archivedDataWithRootObject:myArray];

I saved an array using the following code:

NSData *data = [NSKeyedArchiver archivedDataWithRootObject:myArray];
[[NSUserDefaults standardUserDefaults] setObject:data forKey:@"myArray"];

What is the c开发者_StackOverflow中文版ode to load it back into memory?


Put this where you need to load it, should work. You'll get back an immutable NSData object.

NSData *data = [[NSUserDefaults standardUserDefaults] dataForKey:@"myArray"];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号