Adding a sandboxed app to an app group

This is a relatively simple task that is complicated by confusing documentation. After viewing the documentation it looked relatively simple to add applications to a group. Just add some magic to the entitlements and use the containerURLForSecurityApplicationGroupIdentifier: method of NSURL. The only problem was that as far as I can tell NSURL does not have a containerURLForSecurityApplicationGroupIdentifier: method.

The key to add looks something like this:


The random numbers are your development team ID. I believe that can be found by looking at your developer ID certificate in keychain viewer (someone correct me if I am wrong). After the period you can put whatever you want as long as it matches the string in the other applications you want to be part of a group.

Once you do this all applications sharing that key will have access to:

~/Library/Group Containers/<application-group-id>

Without the containerURLForSecurityApplicationGroupIdentifier: there isn’t a great way to get this path. I just did:

NSString *groupContainer = [@"~/../../../Group Containers/" stringByExpandingTildeInPath];

Let me know if anyone knows of a better way to create app groups.


Now read this

Saving Multiple Related Items (Files) from a Sandboxed Application

On the Mac App Store applications are required to be sandboxed. This means that an application has a restricted set of files that it can access. For most document based applications saving to arbitrary locations is relatively easy... Continue →