In the application I’m working on, I’m generating a username and password and storing them in [NSUserDefaults standardUserDefaults]. I know there’s some system-wide information you can retrieve from there; does that mean all the applications on the phone have access to everything in there? I’m currently prefixing the keys I’m using in there with some strings of characters related to my application name to avoid conflicting with other applications, but is this necessary? And if so, is there a better way to avoid such collisions?
In the application I’m working on, I’m generating a username and password and storing
Share
NSUserDefaults uses the abstract concept of “search paths” to look for defaults values. Unless you customize it, the standard user defaults object will look in three places; the launch arguments, your application’s preferences, and the system preferences (for example global localization options). You can also manually add identifiers for other search paths, if you wanted to share the same preferences between more than one application (I haven’t tried this with the iPhone, so I’m not sure if it’s available on Cocoa Touch or if you can only do this on OS X).
You could potentially have a conflict with one of the systemwide preferences, but since your application’s search path is searched first it’s never an issue.