Search code examples
macoscocoaobjective-c++

Mac Application Name


Our Application deployment structure is something like this:

  1. User can download the application form the server,
  2. Application name it self contains timestamp, when user requested, on a Specific period of time, it should be prompt user for some more info.

So when user download the Application, Application name would contain APPName_24234442424234.

NSString *pAppName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];

it was coming NULL; and then i tried this:

NSString *pAppName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];

I was expecting it to be name of the application, but it returns the one, that we set during the project creation time.

Is there any way to get the "Changed Name" of the Application programmatically?


Solution

  • If your server is just changing the name of the app wrapper before sending it to the requester, then the infoDictionary isn't going to change. You probably want to use

    [[NSBundle mainBundle] bundlePath]
    

    or

    [[NSBundle mainBundle] bundleURL]
    

    and then parse that string to figure out the actual name of the wrapper.

    joe