Skip to main content
This topic has been closed for replies.

1 reply

jadams602
Inspiring
June 23, 2017

If you are getting an exception with trying to use an Open or Save Panel:

Terminating app due to uncaught exception 'NSObjectNotAvailableException', reason: 'service com.apple.appkit.xpc.openAndSavePanelService failed to init an instance of NSOpenPanelService on behalf of

remember that macOS apps on the Mac App Store must work in the sandboxed environment, so make sure you follow all of Apple's rules with file access exceptions with sandboxed apps:

Technical Q&A QA1773: Common app sandboxing issues

With Open/Save you need to make sure you include in your Entitlements.plist:

<key>com.apple.security.files.user-selected.read-write</key>

<true/>

and that you don't try to programmatically open or save a file outside your app's sandbox folders programmatically but only present an open or save panel where only your user chooses throw the open or save panels the location to open or save a file. Only when the user chooses a file will the app be able to access files outside the sandboxed environment. (Details in Apple's documentation).

Using AIR's open and save panels should conform to these Apple requirements when using the latest AIR SDKs.

jadams602
Inspiring
June 23, 2017

By the way, when you are packaging up a macOS app for submission to the Mac App Store and you have built your .pkg for submission, you can actually test and deploy this sandboxed version locally on your mac into the /Applications folder using:

sudo installer -store -pkg XXXX.pkg -target /

where XXXX is the name of your app .pkg.

This could possibly help you test your app in a sandboxed environment before giving it to Apple that you wouldn't experience yourself to in direct .app development builds.