How to get App Groups name programmatically? How to get App Groups name programmatically? objective-c objective-c

How to get App Groups name programmatically?


You'll only be able to use this in development (Debug mode), the entitlements are written into the embedded.mobileprovision file in the app bundle.

The embedded.mobileprovision will not be included when you archive an .ipa file or deliver your app to the AppStore.

When in Debug you can try this:

/* Swift 3 */if let path = Bundle.main.path(forResource: "YourProjectName", ofType: "entitlements") {    let dict = NSDictionary(contentsOfFile: path)    let appGroups: NSArray = dict?.object(forKey: "com.apple.security.application-groups") as! NSArray}


So, the correct answer is: It doesn’t work.Use a static class or constants for your app group names.