How to get application group names programmatically?

I am using extensions in my application. To exchange data between an application and an extension using application groups. How can I read the application group name programmatically, so there is no need to create an additional configuration file to store the application group name.

+7
ios objective-c swift watchkit
source share
1 answer

You can only use this in development (debug mode), entitlements written to the embedded.mobileprovision file in the application bundle.

embedded.mobileprovision will not turn on when you archive the .ipa file or deliver your application to the AppStore .

In Debug you can try the following:

 /* 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 } 
+2
source share

All Articles