Should app group containers have a team ID or not?
I'm creating a Mac app with a built-in sharing extension and I'm trying to set up app groups to share data between them. In Xcode, under Capabilities, I have enabled App Groups and set one value: $ (TeamIdentifierPrefix) com.company.App in both the parent app and the sharing extension. When I run the parent app, it creates a folder: Library / Group Containers / com.company.App (no command id). When I run the extension, it creates a folder: Library / Group Containers / TEAMID .com.company.App with the team ID.
Why do two executables create different containers and how can I define the same container for both?
source to share
You should not include the Application extension in Xcode capabilities.
The methods used to manage group containers are specific.
To access the group container, you must use the [myFileManager containerURLForSecurityApplicationGroupIdentifier: TEAMID.com.company] method in both applications without the APP extension.
To access the UserDefaults (which are shared between the two applications) and store them in the group container, you must call [NSUserDefaults alloc] initWithSuiteName: TEAMID.com.company]
source to share