Shows an issue that prevents apps from accessing player info using AppleScript when sandboxing is enabled.
While Music.app uses a scripting interface very similar to iTunes, security scopes aren't handled the same or have a bug. The following entitlements allow iTunes to fetch the track info without issue. With Music.app an error is shown.
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.Music</key>
<array>
<string>com.apple.Music.playback</string>
<string>com.apple.Music.library.read</string>
</array>
</dict>
Only library information (com.apple.Music.library.read
) seems to be affected. Fetching track artwork for instance works as expected.
- Launch Music.app.
- Run the project.
- Access a song on Apple Music, load a local track or skip a track.
- Grant permission to CatalinaMusicBridge.app to access Music.app.
Notice the error that appears in the Console:
Also note that the player state did update appropriately.
- Disable sandboxing in
CatalinaMusicBridge.entitlements
.
<key>com.apple.security.app-sandbox</key>
<false/>
- Run the project again.
- Skip a track in Music.app.
Notice that the track information gets properly displayed:
- Discovered that the issue is caused by
name
ofcurrent track
. Theartist
,artwork
andplayer state
work as expected (for local tracks at least).