Obtain bundle identifier programmatically in Swift? Ask Question

Obtain bundle identifier programmatically in Swift? Ask Question

How can I get the bundle ID in Swift?

Objective-C version:

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

ベストアンサー1

Try this:

let bundleID = NSBundle.mainBundle().bundleIdentifier

Swift 3+:

let bundleID = Bundle.main.bundleIdentifier

おすすめ記事