Is container migration manifest required to access 3rd party file in ~/Library/Preferences from sandboxed Cocoa app in OS X 10.8 SDK?

  • I'm building a Cocoa app (using OS X 10.8 SDK) to access a file (that was not created or owned by my app) in ~/Library/Preferences/.

    I'm able to access the ~/Library/Preferences from a non-sandboxed app, however when I run my NSTask from my sandboxed app, the path returned is
    /Users/username/Library/Containers/com.companyname.Download-Log/Data/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2: No such file or directory

    At this point I'm guessing the above error message is a result of not finding the preference file I want in my app's sandbox rather than because NSTask (running from within my app) has no access to that preference file. Reading page 36 of the App Sandbox Design Guide suggests that "Preferences for other sandboxed apps are inaccessible".

    I've created an entitlement file. So my question is is it possible to use a container migration manifest to copy the file (that was not created or owned by my app) from ~/Library/Preferences to my app's sandbox. I only need read access and need not modify or write that preference file back out to ~/Library/Preferences.

    Thanks for any pointers and suggestions.
  • On 07/06/2013, at 1:03 AM, Public <mailbox20040630...> wrote:

    > I've created an entitlement file. So my question is is it possible to use a container migration manifest to copy the file (that was not created or owned by my app) from ~/Library/Preferences to my app's sandbox. I only need read access and need not modify or write that preference file back out to ~/Library/Preferences.

    I don't believe that this is possible. The migration manifest only runs once and is used to move preferences and support files from your non-sandboxed app to the sandbox. It will only allow you to move files that are directly linked to your app.

    Even if it did allow what you want, would it help? If the other app later changed its prefs you'd never see that change on subsequent runs of your app.

    A classic example of sandboxing impairing the user experience. I'm afraid like all of us, you'll just have to suck it up or find a supported way around it.

    --Graham
previous month june 2013 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today