0

I've got a pretty simple task that I'm trying to accomplish in Objective-C.

I make a call to a web site, and get a value from the web site through an HTTP call. I want to save this value to disk so I can retrieve it later.

What would be the best method to do this - a text file, or in the PList file?

It's just one value that may occasionally be updated. The call to the web site is made on-demand.

4

1 回答 1

4

考虑NSUserDefaults用于存储单个值

用于存储:

[[NSUserDefaults standardUserDefaults] setInteger:100 forKey:@"storageKey"];

检索:

NSInteger myValue = [[NSUserDefaults standardUserDefaults] integerForKey:storageKey];
于 2013-09-24T17:21:55.107 回答