Hi guys,
someone else has encountered this error with XCode 10 and Mojave? A simple fragment of code, that works fine on applescript, fail during the compilation on XCode with the error "Not authorized to send Apple Events to System Events. (error -1743).
on applicationWillFinishLaunching_(aNotification)
tell application "System Events"
-- any fragment of code that comes to mind
tell appearance preferences
set dark mode to not dark mode
end tell
end tell
end applicationWillFinishLaunching_I have searched in google but I have not found anything,
thanks for help
macOS 10.14 introduces user approval for Apple events as well. You can learn about this in WWDC 2018 Session 702 Your Apps and the Future of macOS Security. However, that session misses one crucial detail: If you app is linked with the 10.14 SDK then you must include the
NSAppleEventsUsageDescription privacy string in your
Info.plist. Without this any attempt to send an Apple event will be denied with an authorisation error.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"