• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bundle Identifiers - and application support directory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bundle Identifiers - and application support directory


  • Subject: Bundle Identifiers - and application support directory
  • From: Peter Hudson <email@hidden>
  • Date: Wed, 10 Jul 2013 11:25:06 +0100

I am trying to create an application support directory for my app ( on 10.8.3 )

I am using this piece of example code ( from the docs ) :-



NSString* bundleID = [[NSBundle mainBundle] bundleIdentifier];
    NSFileManager*fm = [NSFileManager defaultManager];
    NSURL*    dirPath = nil;

    // Find the application support directory in the home directory.
    NSArray* appSupportDir = [fm URLsForDirectory:NSApplicationSupportDirectory
                                        inDomains:NSUserDomainMask];
    if ([appSupportDir count] > 0)
    {
        // Append the bundle ID to the URL for the
        // Application Support directory
        dirPath = [[appSupportDir objectAtIndex:0] URLByAppendingPathComponent:bundleID];

        // If the directory does not exist, this method creates it.
        // This method call works in OS X 10.7 and later only.
        NSError*    theError = nil;
        if (![fm createDirectoryAtURL:dirPath withIntermediateDirectories:YES
                           attributes:nil error:&theError])
        {
            // Handle the error.
        }
    }


When I run the code,  bundleID  is nil.
Is there something that I have to do to give my bundle an ID ?
I have checked the methods of NSBundle ( and NSBundle docs generally ) but cannot see anything that looks promising.


Ultimately, I need to store some user modifiable files -
I am assuming that   NSApplicationSupportDirectory  is the correct place to do this.


Peter






_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Bundle Identifiers - and application support directory
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Dynamically change file name extension in NSSavePanel when extension is hidden
  • Next by Date: Re: Dynamically change file name extension in NSSavePanel when extension is hidden
  • Previous by thread: Re: Dynamically change file name extension in NSSavePanel when extension is hidden
  • Next by thread: Re: Bundle Identifiers - and application support directory
  • Index(es):
    • Date
    • Thread