Tuesday, September 27, 2022

#1 2022-05-30 10:15:08 am

SunnyFrinton
Member
Registered: 2012-09-13
Posts: 42

Not authorized to send Apple events to Contacts. (error -1743)

I have AppleScript code that extracts name and address data from an entry in Contacts which works when running under Script Debugger. But when I include this code into an ApplescriptObjC project in Xcode it fails with the “Not authorised” error. 
When I check the apps allowed to access Contacts in Security & Privacy the ApplescriptObjC project is not listed but cannot add to this list.
Not sure where to go from here so any help gratefully received!

Offline

 

#2 2022-05-30 02:12:07 pm

estockly
Member
Registered: 2009-01-03
Posts: 128

Re: Not authorized to send Apple events to Contacts. (error -1743)

SunnyFrinton wrote:

I have AppleScript code that extracts name and address data from an entry in Contacts which works when running under Script Debugger. But when I include this code into an ApplescriptObjC project in Xcode it fails with the “Not authorised” error. 
When I check the apps allowed to access Contacts in Security & Privacy the ApplescriptObjC project is not listed but cannot add to this list.
Not sure where to go from here so any help gratefully received!




When you execute the command you should get a query from the OS asking if you want to allow your application to have access to Contacts. It might be that since you're calling it from within Xcode that it's not working. Have you saved your project as an app and tried from the app?

ALSO ... The best place to get answers to questions related to ScriptDebugger and AppleScriptObjC is the ScriptDebugger forums

https://forum.latenightsw.com

While most of the experts there (Shane, Nigel, Mark) are also here, they seem to respond faster there. Since you're using ScriptDebugger, you'll see Script Debugger Forums as a selection in the Help menu.

When you ask your question, it's very helpful if you provide your MacOS system and ScriptDebugger versions. Like this:

-->  Script Debugger 8.0.4 (8A52)
-->  Mac OS 11.6.5 (20G527)

Might also help to provide the Xcode version too.

Offline

 

#3 2022-05-31 03:35:38 am

SunnyFrinton
Member
Registered: 2012-09-13
Posts: 42

Re: Not authorized to send Apple events to Contacts. (error -1743)

Thanks for your reply and I’m sorry for not making it clear that Xcode is issuing the error message. I only mentioned Script Debugger because the Contacts code works perfectly with that. This is an existing ApplescriptObjC project that prints a document using name/address data extracted from various sources (email, user input) so wanted to add data from Contacts.
Have tried running the project as an app but no response when selecting the Contacts option.
I am using Xcode 12.5.1 running under Mac OS 11.6.5

Model: MacBook Pro
Browser: Safari 605.1.15
Operating System: macOS 11

Offline

 

#4 2022-05-31 06:22:40 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6793

Re: Not authorized to send Apple events to Contacts. (error -1743)

It sounds like you need to add an NSContactsUsageDescription string to your app's Info.plist file. You can do it in Xcode under the Info tab.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#5 2022-05-31 09:42:02 am

SunnyFrinton
Member
Registered: 2012-09-13
Posts: 42

Re: Not authorized to send Apple events to Contacts. (error -1743)

Thanks, all working now

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)