• 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
Re: getting the bundle name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting the bundle name


  • Subject: Re: getting the bundle name
  • From: Ondra Cada <email@hidden>
  • Date: Sun, 24 Mar 2002 15:09:16 +0100

On Sunday, March 24, 2002, at 08:43 , Donald Hall wrote:

I am trying to get the bundle name for my app using NSBundle methods, but am not having any luck. Can anyone help?

Here is a code fragment:

NSString *bundleName;
NSBundle *myBundle;

myBundle = [NSBundle mainBundle];
NSLog(@"main bundle is %@", myBundle);
bundleName= [myBundle bundleIdentifier];
NSLog(@"bundle name is %s", bundleName);

There is a world of difference between a bundle identifier (a string which uniquely identifies your bundle; you have not set it, but if you did, it should be somrthing like "net.theboss.appsmore.RaiseMan"), a bundle name (which is localizable and could be determined as

[[myBundle infoDict] objectForKey:(NSString*)kCFBundleName]

(unless I have missed something, there is no direct accessor method like that one for the identifier), and the bundle path, which is quite simply

[myBundle bundlePath]

If you wanted the bundle wrapper name, well then it's a part of bundle path, and therefore should be determined by

[[myBundle bundlePath] lastPathComponent]
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >getting the bundle name (From: Donald Hall <email@hidden>)

  • Prev by Date: Re: Service hotkeys on login
  • Next by Date: Re: getting the bundle name
  • Previous by thread: Re: getting the bundle name
  • Next by thread: Re: getting the bundle name
  • Index(es):
    • Date
    • Thread