import ScriptingBridge
class iTunesAccess {
static func requestAccess() -> Bool {
guard #available(OSX 10.14, *) else {
return true
}
if var addressDesc = NSAppleEventDescriptor(bundleIdentifier: "com.apple.iTunes").aeDesc?.pointee {
let appleScriptPermission = AEDeterminePermissionToAutomateTarget(&addressDesc, typeWildCard, typeWildCard, true)
AEDisposeDesc(&addressDesc)
return appleScriptPermission == noErr
}
return false
}
}
info.plist:
<key>NSAppleEventsUsageDescription</key>
<string>somedescriprtion</string>
iTunes running but i always get -600 osstatus. How i can fix it? iTunes bundle id is fine.
/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' /Applications/iTunes.app/Contents/Info.plist
com.apple.iTunes
P.S but if i using "com.apple.dt.Xcode" bundle id it works!
P.P.S i found repo https://github.com/melchor629/iTunes-Scrobbler and build it. It works too.