Hi,
I have an app that relies on NSWorkspace in order to load the content of audio-CDs when they are available.
Since in System Prefs > CD/DVD I have set my app as the default one, when I insert a CD, my app opens and loads its content.
Again, if I open my app and then insert a CD, it will be loaded.
The problem I have is when I open my app when a CD is already mounted on the desktop.
If the app is not sandboxed the app loads the CD by retrieving the volume and sending such folderitem to the relevant parsing-code.
But when the app is sandboxed that workaround does not work, so nothing happens. The only way is to select the CD thru an open-dialog or dropping it into the app’window.
Is there a way to “refresh” NSWorkSpace, or to grant permissions or anything else so that the CD gets automatically loaded?
BTW: I reviewed the app capabilities in AppWrapper but I can’t see anything relevant to add.
[edit] I set iTunes as default app in system Prefs. Opening iTunes when a CD is already on the desktop, iTunes loads it. So there should be a way to do it.
AFAIK iTunes isn’t Sandboxed, for exactly this reason. Now technically there is a way; you’d need full access to the machine in order to get the optical volume (AFAIK), and Apple will not approve your App on the Mac App Store with this capability.
Apple have been known to add special entitlements, but they’re also not known for sharing said special tasks. Many of them are considered “Private” and you’ll not be approved on the App Store for using it.
If you’re not shipping on the App Store, then don’t Sandbox.
Anyway, for this situations I’ll popup a message offering the user to open the optical volume, and if she/he agrees the app will popup another openselectDialog with the right disk already selected so that the user has got only to press Return. Actually I’d have liked to popup a third and even a forth dialog, but I run short of ideas.