- Home /
Question by
Russ Menapace · Oct 10, 2010 at 06:09 PM ·
iphoneplayerprefs
Accessing bundle identifier at runtime on iPhone
I would like to be able to access the bundle identifier on the iPhone, so I can use it to generate the path to the playerprefs file. I found PlayerSettings.iPhoneBundleIdentifier, which would be perfect, but it's only for the editor. How would I get the same information at runtime on the phone?
Comment
Answer by pahe · Nov 30, 2011 at 08:38 AM
Hi. Don't know if this is still needed, but you have to make an external dll call from your game:
[DllImport("__Internal")]
private static extern string _GetCFBundleVersion();
In your xcode appcontroller.mm file you add:
const char* _GetCFBundleVersion()
{
NSString *version = [[NSBundle mainBundle] bundleIdentifier];
return strdup([version UTF8String]);
}
should work. :)
That's the way to go. If you don't want to bother you can find a plugin that does the exact same thing here: http://u3d.as/content/amitloaf/amitloaf-s-tool-package/3RA