ndg
ndg

Reputation: 2645

OS X sandboxing questions

I have a Mac application in the App Store and am looking to adopt sandboxing before it becomes a mandatory requirement. I've run into two issues and was hoping to post here for some insight into best practice in the following situations:

If anyone could clarify the above points, that would be appreciated.

Upvotes: 1

Views: 390

Answers (2)

CRD
CRD

Reputation: 53000

Easy one first: you can run your helper with NSTask and it will inherit the sandbox of your app.

Those URLs: not easily/reliably/at all. There is a way to save NSURLs to files you have access to in such a way that a subsequent run of your application and re-load them and regain access, however it is deemed fragile and not to be recommended. Read the Apple developer forums and this is an Apple acknowledged problem they are "working on"; given this using the fragile solution is probably not worth the effort - search the developer forums for the fragile solution if you really want to hack something that sort of works now.

Upvotes: 0

Francis McGrew
Francis McGrew

Reputation: 7272

1) From my understanding the NSURL object contains the permissions necessary to re-access the files later, so if you are using hardcoded paths, you could replace them with archived NSURL objects. This is also assuming the user selected those filies within an NSOpenPanel at an earlier point.

2) You can run a NSTask but it inherits the permissions of your main app.

Hopefully others can chime in with more information. I've found the Mac Developer Boards, specifically the "Application Sandboxing" forums to be helpful, as Apple employees often drop in. So far, I've found sandboxing to be an unusable mess.

Upvotes: 1

Related Questions