Mojave and "Not authorized to send Apple events to Finder" issues

Hi
I have built and maintained an app using Xcode, with the help of many from here that I use to help automate my workflow, in a prepress environment, it’s a work in progress and has been for about 10 years, i’m a novice coder, and have managed to keep the app current to OSX 10.12.6, the app interacts wit Indesign CC, Finder, System events etc, and works pretty well for my purpose.

I have recently installed Mojave on a test mac to try to build my app to suit, and this is where the trouble starts, lots of new security
measures have been put in place, of which I have tried to set up in Security & Privacy prefs, but alas I keep getting an
error “Not authorized to send Apple events to Finder” and i’m guessing that as I go through more in my code ill get similar issues, I have found that to by pass these errors I would need to code sign my app, of which I have no idea or the knowledge to do, or run it as “run only”, don’t even no if thats possible.

The question is, how can I code my app, or change some settings in Xcode to allow me to run my app in Mojave
as I feel if I cannot do anything, that my app will stop, and that will be the end.

Thanks for any insight

You are going to see authorization dialogs as you test your app, and users will see them the first time it tries to control any app – that’s how things work in 10.14. But it’s far from the end of the world. Just make sure you add the correct privacy entry to your app’s Info settings.

If you’re just using it internally you can probably get away with ad-hoc code signing, but really, you should consider paying for an Apple developer account and doing it properly.

thanks for your input Shane, I tried the ad hoc code sign, failed , so I signed up to Apple developer, to try to code sign that way, failed, im now getting “codesign failed with exit code 1” not sure how to deal with that.

my settings under signing are set to automaticlly manage, my team name, and my signing certificate, im really in quite deep here and uncertain what else to do to make my app run, as the builds keep failing, Its only for in house use, ill keep trying different things,

Don’t do that – it’s for App Store stuff. Turn it off, select None for Provisioning Profile, your name under Team, and Developer ID Application under Signing Certificate.

thanks Shane, that made some difference, but found this out

this morning I went out searching and found that the pro I’m getting now, which is “resource fork, Finder information, or similar detritus not allowed”
leads to “Code signing no longer allows any file in an app bundle to have an extended attribute containing a resource fork or Finder info.”

Running this in terminal xattr -lr <path_to_app_bundle> returned a heap of information, the most relevant being

/Users/budgie/Documents/PREPRESS MASK: com.apple.quarantine: 0082;00000000;The Unarchiver;
MacBook-Pro-2:~ budgie$

and things like this

/Users/budgieDocuments/PREPRESS MASK/CFOST.applescript: com.apple.quarantine: 0082;5cee37ae;The Unarchiver;
/Users/budgie/Documents/PREPRESS MASK/TOONETO.applescript: com.apple.TextEncoding: utf-8;134217984
/Users/budgieDocuments/PREPRESS MASK/TOONETO.applescript: com.apple.metadata:kMDLabel_7phsxbgq5wfae5sfal2ymrmdya:

I thought “The Unarchiver” was the culprit, but could not locate it, not sure how to pull this apart.

ok a bit more progress

ran this in terminal first xattr -lr <path_to_app_bundle> got the result in the the last post

then ran this after in terninal xattr -cr <path_to_app_bundle> which according to the tech data

“removes all extended attributes from your app bundle with the xattr command”

then did a clean, and rebuild, now my error is less and different, it now looks like this

DELETEINDDEXT.applescript:10: error: Expected end of line but found class name. (-2741)
Command /usr/bin/osacompile failed with exit code 1

so, ill delete this and see what comes of it

SUCCESS code sign achieved

but! i’m still getting

2019-05-30 09:06:10.354681+1200 PREPRESS MASK[4106:309629] *** -[NEWFOLDER CreateFolder:]: Not authorized to send Apple events to Finder. (error -1743)

that seems to be the only error now after successful code signing

the above result is from code that basically asks the finder to make a folder on the desktop, named with the content of the clipboard, which is text.

You can add a build phase to run the xattr bit each time.

Have you added a Privacy - AppleEvents Sending Usage Description string under the project Info tab?

no I didn’t, but I have now, and all seems pretty good, thanks for the guidance, would be in a world
off kaka otherwise, appreciated

I try and code sign on a mac running OSX 10.12.6 and xcode 9.2, I don’t see the
“Privacy - AppleEvents Sending Usage Description string under the project Info tab”

so when I copy my app to a computer running 10.14 it reverts back to the issue of finder not being allowed to do things, is the setting called by a different name?

The setting was introduced in 10.13 or 10.14, from memory.