Benches iPhone

2

IPhone - "Application Support" folder mis…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

HI All

i am trying to access application Directory through this snippet

NSArray *dirs = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);

NSString *appSupportFolderPath = [dirs objectAtIndex:0];

NSString *ourAppDirectoryName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleExecutable"];

ourAppDirectoryPath = [[NSString alloc] initWithString:[appSupportFolderPath stringByAppendingPathComponent:ourAppDirectoryName]];

NSLog(ourAppDirectoryPath);

Out Put

/Users/rajusb/Library/Application Support/iPhone Simulator/User/Applications/9552F49E-7506-4E33-81C1-8B2A1B6AE850/Library/Applic ation Support/AEMSample

after running application on simulator i explored "Library" folder and i found that "Application Support" Directory was missing.

my question is whether i have to create "Application Support" and its sub folder "AEMSample"(Application Name) manually or is it an issue with an iphone simulator?

2 replies

Sign in or join Beachball Help to reply.

  1. 0

    RickMaddy

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    First off, wrap your code like this:


    code here

    <-- no slash

    Now have a look at the "iPhone OS Programming Guide". There is a section titled "File and Data Management". Under there is a discussion of the iPhone directory structure. There are basically 4 directories:

    <app sandbox>/YourApp.app

    <app sandbox>/Documents

    <app sandbox>/Library/Preferences

    <app sandbox>/tmp

    That's all you get. Virtually none of the values for NSSearchPathDirectory work on the iPhone.

    The 'YourApp.app' directory is essentially read-only. You can write to it without error but in fact when you read again it will be the original content.

    The Documents directory is your best bet for storing files. Normally its content is kept even after a user upgrades to a newer version of your app. Access to this directory can be had using the only working NSSearchPathDirectory value of NSDocumentDirectory.

  2. 0

    proof ddfdfgdfddfgdfffffffffff

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks RickMaddy...