Question

I'm having some trouble with two Sandboxed applications in one Application Group. In my Entitlements file i have the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/    PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>com.apple.security.app-sandbox</key>
     <true/>

     <key>com.apple.security.application-groups</key>
     <array>
          <string>TEAM_ID.com.Company.AppName</string>
     </array>
</dict>
</plist>

Where 'Company' and 'AppName' are replaced with my company and the App name and TEAM_ID with my team's id. Both applications have these exact same entitlements.

Now, when i build and launch both apps everything seems to be going quite allright. Except for the fact that there is no 'Group Containers' folder to be found in my ~/Library folder... There IS a 'Containers' folder with a folder for both apps. But no Group Containers folder.

I'm running 10.8.2 and my app's deployment target is 10.8.

According to the Developer Library it should be available from 10.7.4. I've used this: https://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW19 to create my entitlements.

What am i doing wrong?

Thanks,

Was it helpful?

Solution

Someone on the official Apple Developer Forums suggested creating the folder programmatically, which was the solution to my problem!

NSString *groupContainer = [@"~/../../../Group Containers/TEAM_ID.com.Company.AppName" stringByExpandingTildeInPath];

[[NSFileManager defaultManager] createDirectoryAtPath:groupContainer withIntermediateDirectories:YES attributes:nil error:NULL]]

I've used the Group Container folder for a plist file in which my main application can write settings that my helper (deamon) application can read (using the initWithContentsOfFile: and writeToFile: methods of NSMutableDictionary). This works perfectly now :)

OTHER TIPS

As an update to @jeppeb, I too had to manually create the folders. In Swift, Mac OSX 10.14, I found using:

let appSupport: String = NSString(string: "~/Library/Group Containers/com.myCo.myAppName/Library/Application Support").expandingTildeInPath
try fileMan.createDirectory(atPath: appSupport, withIntermediateDirectories: true, attributes: nil)

let caches: String = NSString(string: "~/Library/Group Containers/com.myCo.myAppName/Library/Caches/myCacheFolder").expandingTildeInPath
try fileMan.createDirectory(atPath: caches, withIntermediateDirectories: true, attributes: nil)

let prefs: String = NSString(string: "~/Library/Group Containers/com.myCo.myAppName/Library/Preferences").expandingTildeInPath
try fileMan.createDirectory(atPath: prefs, withIntermediateDirectories: true, attributes: nil)

I can't believe this is the proper way of doing things but in the absence of any other answer I've found so far, this is what I needed to do to create a Groups Container folder along with a Preferences folder to store any suite preferences I used....

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top