0

I`m trying to control the Spotify using my custom switch app. Creation works OK but each communicaction ends with nil or undefined value. For example this snipped prints "??":

func applicationDidFinishLaunching(_ aNotification: Notification) {
    let player = SBApplication(bundleIdentifier: "com.spotify.client")! as SpotifyApplication

    switch player.playerState {
        case .paused:
            print("paused")
        case .playing:
            print("playing")
        case .stopped:
            print("stopped")
        default:
            print("??")
    }
}

Any idea what am I doing wrong?

Aleksey Potapov
  • 3,683
  • 5
  • 42
  • 65
mikeek
  • 132
  • 11

1 Answers1

1

Thanks to the @matt I found the solution - Info.plist was missing "Privacy - AppleEvents Sending Usage Description"

mikeek
  • 132
  • 11
  • Link to key description https://developer.apple.com/documentation/bundleresources/information_property_list/nsappleeventsusagedescription – Klaas Jul 16 '21 at 13:30