1
votes

I have an app which needs to preserve data between times it runs. I had been using NSUserDefaults for this, but I've had a few users point this out to me: this causes different users to end up with different data, which isn't the way the app should work. It needs a single directory that it can read/write from regardless of which user is running it.

So, I need a non-user specific directory that a sandboxed mac app can read and write to.

Thanks!

(Oh, and if this directory is persistent between updates of my app, that'd be helpful, too!)

Quick barely related question: Is there a way to have a user modifiable resource file in a Mac App Store approved app? I don't want it to be modifiable via my app; I just want to make sure that users modifying it won't cause the system to kill the app for not matching a code signature hash or something.

1
Valve (makers of Steam) will be launching a competeting app store soon which will be much more flexible... with any luck, Apple will fix their sandbox implementation to allow such a directory in response, but if they don't I can always sell a better version of my app on Steam.ArtOfWarfare

1 Answers

1
votes

I don't think that you will be able to read and write in a directory outside of the App Sandbox container without prompting the user to select it using Powerbox and saving a security-scoped bookmark (see App Sandbox Container Directory). From what I've gathered about App reviews lately, you won't even be able to specify a default in the open dialog if you elect to have the user choose the directory.

As for the second question, as I understand it any verification of code signatures is left to the developer. So while MAS apps have a _CodeSignature folder containing a plist with all the hashes of the resource, in my experiments changing them had no effect on app launch.