Search code examples
iphoneobjective-clocaleinfo.plist

iPhone info.plist keys in different languages for different locales


I'm having some trouble with a check that I'm performing using the info.plist.

Basically, I'm finding the location of the executable file using the executable name in the info.plist.

The key for the executable file in the plist is "Executable file" (in English), which I need. However, the problem I'm facing is that the key is not the same for all locales. It's different for some locations, but not others.

My question is: How can I find the location of the executable file no matter what language or locale?

Any help would be greatly appreciated.

Thanks!


Solution

  • You get the path to the executable with

     NSString *exePath = [[NSBundle mainBundle] executablePath];
    

    Note also that by default, Xcode displays "user-friendly" strings for keys in the Info.plist, such as "Executable file" or "Bundle Identifier":

    enter image description here

    But this are not the real keys in the Info.plist. If you Ctrl-click in the Info.plist window and choose "Show Raw Keys/Values", then you see the real keys:

    enter image description here

    So the key for the executable file is "CFBundleExecutable", regardless of your language.