Thursday, February 10, 2011

File placement for iPhone Applications

If your application accesses and edits an already existing file is it okay for that file just to be placed in the resources folder?

  • No, because the app bundle is read-only on the iPhone. You would have to copy the file from the bundle to your app's documents directory on first launch. Use this code to find the documents directory:

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

0 comments:

Post a Comment