com.apple.iTunes AEDeterminePermissionToAutomateTarget始终返回-600 [英] com.apple.iTunes AEDeterminePermissionToAutomateTarget is always return -600
问题描述
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:
info.plist:
<key>NSAppleEventsUsageDescription</key>
<string>somedescriprtion</string>
iTunes正在运行,但我总是得到-600 osstatus. 我该如何解决? iTunes捆绑包ID很好.
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,但如果我使用"com.apple.dt.Xcode"捆绑包ID,则可以使用!
P.S but if i using "com.apple.dt.Xcode" bundle id it works!
我找到了PPS回购 https://github.com/melchor629/iTunes-Scrobbler 和建立它.也可以.
P.P.S i found repo https://github.com/melchor629/iTunes-Scrobbler and build it. It works too.
推荐答案
对NSAppleEventsUsageDescription
键的调用很好-如果您链接到10.14 SDK,则需要此调用-但如果您的应用已沙箱化,则还需要一个适当的Apple事件授权:如果可以,则为com.apple.security.scripting-targets
,如果必须则为com.apple.security.temporary-exception.apple-events
.请参阅 https://developer.apple.com /library/archive/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AppSandboxTemporaryExceptionEntitlements.html 了解更多详细信息,包括指定两种权限的一种方法,但仅一种适用于当前操作系统版本.
Good call on the NSAppleEventsUsageDescription
key — that’s required if you link against the 10.14 SDK — but if your app is sandboxed, you’ll also need an appropriate Apple event entitlement: com.apple.security.scripting-targets
if you can, or com.apple.security.temporary-exception.apple-events
if you must. See https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AppSandboxTemporaryExceptionEntitlements.html for more details, including a way to specify both entitlements, but only one applies depending on the current OS version.
这篇关于com.apple.iTunes AEDeterminePermissionToAutomateTarget始终返回-600的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!