开发者

In an iOS application, where do I store my saved user data?

Where is the appropriate place to stare saved data from users in an iOS application? There doesn't appear to be a particular p开发者_如何学运维lace, according to the samples and tutorials I've seen.

The Locations sample project uses this path:

[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]

ButI'm not sure if that's technically an app specific path, or if that's somewhere else in the file system.

Also, I guess I could use a bit of a primer on how the iOS file system works from an App's point of view.


NSUserDefaults is where I'd start.

From the docs:

The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. The defaults system allows an application to customize its behavior to match a user’s preferences. For example, you can allow users to determine what units of measurement your application displays or how often documents are automatically saved. Applications record such preferences by assigning values to a set of parameters in a user’s defaults database. The parameters are referred to as defaults since they’re commonly used to determine an application’s default state at startup or the way it acts by default.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜