Music.app on macOS 10.15 does not supply Audio CD's track name

I am trying to get ready my app for next version of macOS 10.15 Catalina. I am using scripting bridge in my app, and then trying to get Audio CD information from Catalina's new app, Music.app.


The following is the part of my code:

#import <Cocoa/Cocoa.h>
#import <ScriptingBridge/ScriptingBridge.h>
#import "Music.h"

@implementation ViewController

- (IBAction)pushButton:(id)sender {

    MusicApplication* Music = [SBApplication applicationWithBundleIdentifier:@"com.apple.Music"];

    SBElementArray *sources = [Music sources];

    MusicPlaylist *anAudioCDPlayList = nil;

    for (MusicSource *src in sources) {

        SBElementArray *playlists = [src audioCDPlaylists];

        MusicPlaylist *aPlaylist = playlists[0];

        anAudioCDPlayList = [aPlaylist get];
    }

    for (MusicTrack *aTrack in [anAudioCDPlayList tracks]) {

        printf("aTrackName=%s\n",[[aTrack name] UTF8String]);
    }
}

@end


I have enabled app sandbox and Entitlements is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.scripting-targets</key>
    <dict>
        <key>com.apple.Music</key>
        <array>
            <string>com.apple.iTunes.library.read-write</string>
            <string>com.apple.iTunes.user-interface</string>
        </array>
    </dict>
</dict>
</plist>


I know that I am using the word "iTunes" in entitlements, but it seems correct.


I also added "NSAppleEventsUsageDescription" Key/Value set in info.plist.


Now, I can get Audio CD information on Music.app except track name. My question is Why I can't get Audio CD track name even though other information can be retrieved?

I found that the following:

1.When I can't get Audio CD track name, console.app shows Music.app's Apple Event error, "AppleEvents/sandbox: Returning errAEPrivilegeError/-10004 and denying dispatch of event core/getd from process '<private>'/0x0-0x87087, pid=1138, because it is not entitled to send an AppleEvent to this process." message. Where 1138 is my app's pid.


2.If I set app-sandbox off, I can get Audio CD track name.


So I guess that there might be entitlement to be added...What is it?

Good find!

I'm running into the about the same issue. It looks like this happens when you try to access properties from the super class of MusicTrack, i.e. MusicItem. "name" is part of that one.


Seems like a bug to me.

> when you try to access properties from the super class of MusicTrack, i.e. MusicItem. "name" is part of that one.


Yes I agree with you.


> Seems like a bug to me.


Me too hope so...

Did you report this yet? I thought I could workaround this, but I'm not able to do so.

Ya, I've aleady report this issue via feedback assistant.

The reason why I post this issue here is to share with someone and to get some help.

Do you have any workaround for this issue? Could you tell me how to?

Checking in to see if you've found a way to interact with the Music app with sandbox enabled.

Music.app on macOS 10.15 does not supply Audio CD's track name
 
 
Q