Is this possible?
In this question I saw that you add to the entitlements file:
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.iTunes</key>
<array>
<string>com.apple.iTunes.library.read</string>
<string>com.apple.iTunes.playback</string>
</array>
</dict>
for read access. But how do you get write access? I looked in the documentation and they suggest the manual for sdef
, but I couldn't extract any information from this.
Also, would this hamper a submission to the App Store?
Alright, from what I know (and from what logic tells me) adding entitlements which are not temporary exceptions (com.apple.security.temporary-exception.something) does not hamper the submission of your app. Your app is still accepted, provided that it is clear to the reviewers why you need them. In fact, when submitting an app to iTunes Connect you need to justify every temporary exception ("You must provide information for each temporary exception entitlement specified in your binary."), but I'd justify every entitlement just to be sure there are no misunderstandings.
Now regarding your specific problem: creating playlists. I haven't tried it, but I pretty certain it is possible. This is what you need:
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.iTunes</key>
<array>
<string>com.apple.iTunes.library.read-write</string>
</array>
</dict>
If you have read only then you can't create playlists, since that operation is writing info. The playback one is for controlling playback, which is not necessary if all you want to do is create playlists (you might want this one for other stuff, though - depends on your app).
Lastly, I add that I too find myself limping around due to the lack of information concerning Access Groups for scripting. The only resource I have is the PDF for the WWDC 2012: Secure Automation Techniques in OS X
talk, in which they have some examples of entitlements for some apps. I really hope this technology is developed further...
EDIT:
I just wanted to say you might want to check this question out for the code, if you haven't written it already.