Posted by: bearc0025 | December 30, 2009

Accessing Info.plist within your iPhone App

I needed to access the app name w/in my app. I figured I cd get it from the Info.plist display name or executable. Yep.

See all the values w/ this (print out below)…

	NSLog(@"%@", [[NSBundle mainBundle] infoDictionary]);

Or get a single value w/ this…

	NSString *exeName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];

You can get the dictionary key names from the plist file in Xcode. Just set the view to show the raw key names…

Set Raw Key Names in Xcode (click to enlarge)

Set Raw Key Names in Xcode (click to enlarge)

The raw key names…

Raw Key Names (click to enlarge)

Raw Key Names (click to enlarge)

Print out the dictionary…

2009-12-30 10:52:09.948 MyApp [32400:207] {
    CFBundleDevelopmentRegion = English;
    CFBundleDisplayName = MyApp;
    CFBundleExecutable = MyApp;
    CFBundleExecutablePath = "/Users/bear/Library/Application Support/iPhone Simulator/User/Applications/722BFAB7-9A59-4282-A0EF-BD5675B44FE8/";
    CFBundleIdentifier = "com.yourcompany.MyApp";
    CFBundleInfoDictionaryVersion = "6.0";
    CFBundleInfoPlistURL = Info.plist -- file://localhost/Users/bear/Library/Application%20Support/iPhone%20Simulator/User/Applications/722BFAB7-9A59-4282-A0EF-BD5675B44FE8/;
    CFBundleName = MyApp;
    CFBundlePackageType = APPL;
    CFBundleSignature = "????";
    CFBundleSupportedPlatforms =     (
    CFBundleVersion = "1.0";
    DTPlatformName = iphonesimulator;
    DTSDKName = "iphonesimulator3.1.2";
    LSRequiresIPhoneOS = 1;
    NSBundleInitialPath = "/Users/bear/Library/Application Support/iPhone Simulator/User/Applications/722BFAB7-9A59-4282-A0EF-BD5675B44FE8/";
    NSBundleResolvedPath = "/Users/bear/Library/Application Support/iPhone Simulator/User/Applications/722BFAB7-9A59-4282-A0EF-BD5675B44FE8/";
    NSMainNibFile = MainWindow;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: