1 Reply
      Latest reply on Feb 20, 2017 1:28 AM by eskimo
      TOLIS Tim Level 1 Level 1 (0 points)

        I have an older app that stored non-volatile setting definition files in ~/Library/Preferences/ in the form of plist files.


        In refactoring the app for the MAS, I see that I would need an exception of com.apple.security.temporary-exception.shared-preference.read-write to continue doing this.  However, I can't find a good definition of where a sandboxed app should save non-volatile settings that are user account specific.


        Where should we save files of this type so that our app will pass sandbox requirements (documentation pointers are always welcome)?

        • Re: What non-sandboxed folder should an app use instead of requesting temporary-exception.shared-preference.read-write to access the user's Preferences folder?
          eskimo Apple Staff Apple Staff (13,875 points)

          You should be able to use the Library/Preferences/ directory within your app’s container for this.  However, my general recommendation is that you avoid that (leave Library/Preferences/ as the preserve of NSUserDefaults) and instead create a directory within Libarry/Application Support/.  You can find that with -[NSFileManager -URLForDirectory:inDomain:appropriateForURL:create:error:] with the NSApplicationSupportDirectory selector.

          IMPORTANT Remember that these paths are relative to your app’s container, not in the user’s home directory, and thus you don’t need any extra entitlements to access them.

          You should make to read the Migrating an App to a Sandbox section of the App Sandbox Design Guide, which shows how you can move things from the old place to the new place when the user first launches the sandboxed version of your app.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"