Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac App Sandbox Group Container problems

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,

like image 420
jeppeb Avatar asked Oct 21 '22 16:10

jeppeb


1 Answers

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 :)

like image 141
jeppeb Avatar answered Oct 24 '22 12:10

jeppeb