How to get bundle ID?

前端 未结 7 2126
太阳男子
太阳男子 2020-12-29 01:19

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 someth

7条回答
  •  温柔的废话
    2020-12-29 02:07

    A bundle ID or bundle identifier identifies an application in Apple's ecosystem. Apple advice to use reverse domain name(reverse DNS notation) to create it.

    For example:

    com.companyname
    

    Bundle identifier is a string in Info.plist[About] which is required for any Bundle

    To set it using Xcode

    //Info.plist
    Bundle identifier
    //by default it points on `$(PRODUCT_BUNDLE_IDENTIFIER)` which is you can setup in Build Settings
    
    //Build Settings the mirror of Target Settings
    Build Settings -> Product Bundle Identifier
    
    //Target Settings the mirror of Build Settings
    General -> Bundle Identifier
    

    To get it programmatically

    //Objective-C
    [[NSBundle mainBundle] bundleIdentifier];
    
    //Swift
    Bundle.main.bundleIdentifier
    

    [Vocabulary]

提交回复
热议问题