Part 5: File System stuff and path to Documents directory – A .net developer learns objective-c for iPhone iPad

Some quick info for the file system on the iOS.

Documents – persists data and is backed up when you connect itunes.

tmp – used for your temp app stuff. Not to persist data and you should clean up that directory whenever possible by your app.

Library/Caches – persists app specific data between launches of the app. Not backed up.

Library/Preferences – app specific preference settings data (but use CFPreferences API), Gets backed up.

More info at apple’s site here.

 

Quickly get the path to your Documents directory here:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

// get a file called foo.xml

NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@”foo.xml”];

Getting the tmp directory is a bit easier:

NSString *tmpDir = NSTemporaryDirectory();

About InteractiveWebs

This blog is the combined blog work of the InteractiveWebs Dev Team. Together we work on a range of DotNetNuke (DNN) applications, modules, Silverlight, and Microsoft CRM Portal integration products.

Our Business is website design and hosting, with a strong focus on DotNetNuke, Microsoft Dynamics CRM, Silverlight and iPhone iPad development.

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *