Obtain Bundle Identifier programmatically

前端 未结 6 2010
日久生厌
日久生厌 2020-12-12 13:50

How can I obtain a string of the Bundle Identifier programmatically from within my App?

6条回答
  •  温柔的废话
    2020-12-12 14:37

    f 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
    

    Updated for latest swift It will work for both iOS and Mac apps.

提交回复
热议问题