How to get bundle ID?

jln646v picture jln646v · Jan 15, 2012 · Viewed 72.8k times · Source

I am working on getting the facebook API working for iOS, and the FB registration page requires the Bundle ID of the project. How can I get this information? I read something about getting it at run time, but is there a way to get Xcode to tell me this information, or is it held in a plist somewhere. I am not using the default bundle id, I remember setting it while I created the project.

Answer

Aks picture Aks · Sep 8, 2016

If you are trying to get it programmatically , you can use below line of code :

objective C

NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];

Swift 3.0 :

let bundleIdentifier =  Bundle.main.bundleIdentifier

It will work for both iOS and Mac apps Good luck..