SBApplication 无通信
SBApplication no communication
我正在尝试使用我的自定义切换应用程序来控制 Spotify。创建工作正常,但每次通信都以 nil 或未定义的值结束。例如这个剪断打印“??”:
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("??")
}
}
知道我做错了什么吗?
感谢@matt,我找到了解决方案 - Info.plist 丢失了 "Privacy - AppleEvents Sending Usage Description"
我正在尝试使用我的自定义切换应用程序来控制 Spotify。创建工作正常,但每次通信都以 nil 或未定义的值结束。例如这个剪断打印“??”:
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("??")
}
}
知道我做错了什么吗?
感谢@matt,我找到了解决方案 - Info.plist 丢失了 "Privacy - AppleEvents Sending Usage Description"