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();