开发者

iPhone SDK: NSUserDefaults or NSDictionary?

Compare the following:

  • using NSUserDefaults saving it with synchronize
  • using NSDictionary saving it with writeToFile in the app Documents folder

What are the differences? Personally, I prefer to mantain different NSDictionary organized by topic rather than use a single NSUserDefaults.

Am I thinking s开发者_如何学运维omething wrong? Thanks


It depends on the kind and amount of data that you want to save and how you want to access this data. Property list files in the documents directory can be deserialized on demand while the user preferences are usually read early after launching the app. They also contain keys owned by the system.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜