I have an info dictionary that contains user data. Currently, it is written to an xml file in the same directory as the app. However, I’m pretty certain cocoa allows me to write this xml file into the application bundle or some Resources directory within the app.
Can someone teach me how to do this?
You would want to use
NSFileManagertocreateFileAtPath:contents:attributes:in theNSDocumentDirectory(relative to your bundle this is/Documents) with theNSDataof your xml file.Something like this:
Some references:
NSFileManagerReference DocsNSDataReference DocsEdit
In response to your comments, this would be typical usage of
NSUserDefaultsto save serializable data between App runs:To retrieve a saved value (next time the App is launched, or from another part of the App, etc):
NSUserDefaultsReference Docs