I have set up App Groups for both my host app and the share extension. The identifier looks like "group.com.abc.xyzApp". Is there a way to get this string out programmatically? Also, how do I detect if app groups are set programmatically? Is trying to initialize a file container or user defaults with the app group identifier enough to know? Eg:
[[NSUserDefaults alloc] initWithSuiteName:@"group.com.abc.xyzApp"].
App groups allow multiple apps produced by a single development team to access shared containers and communicate using interprocess communication (IPC). Apps may belong to one or more app groups. For iOS, format the identifier as follows: group.<group name>
User Defaults Group You have to enable app groups in both your app's and extension's targets as well as at the developer's portal. Then you are able to use UserDefaults container which can be shared between several apps (or between the app and the extension).
Keychain sharing is used when we want to share some data securely between two or more applications from the same developer. Suppose we want to share some critical data(like username and password) between two apps.
App Extensions are an iOS feature that allows developers to extend the functionality and content of their app beyond the app itself, making it available to users in other apps or in the main operating system.
You cannot detect if you get something programatically, but I think this is not very usefull.
Why you need to change this? by environment maybe? If so, you can do it by project variables and then add this to your info.plist
Later you can get it with:
main.object(forInfoDictionaryKey: "AppGroupId") as? String
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With