Problems/Limitations when app is Notarised for macOS10.14

I have started a new thread because it seems when you notarise your apps for macOS10.14, it can break some things. Oh boy …

These are the two things I noticed - more may follow.

- Creating a declare is more piccy. For example you can not use libobjc.a.dylib anymore.You need to use Cocoa instead.

- The below code will not work anymore. It’s code to reveal a file in the Finder.

dim a as AppleEvent = New AppleEvent("misc", "slct", "com.apple.finder") a.FolderItemParam("----") = f If a.send then a = New AppleEvent("misc", "actv", "com.apple.finder") If a.send then //success Else //activate failed End if Else //select failed End if

Maybe it needs an entitlement like in a Sandboxed app? Will do some test later.
BTW this script does work when I do not notarise the app. So it has nothing todo with the new way of Mojave dealing with permissions.

- AppleScripts do not work at all (I use AppleScriptMBS).
The AppleScripts I tried do refer to Finder. So maybe there is a new entitlement needed to use the Finder ?

the user must accept your app to run applescripts. like the location before 10.14

It would be even better if you specified the actual framework that you are using. If the function you are making exists in more than one place, the Library is used to call the right one.

In the capabilities pane of App Wrapper, the first option at the top has the ability to attach entitlements without Sandboxing your application. Give that a try.

As I wrote, it has nothing todo with ‘permissions’. I know the user has to approve this in Mojave. It works fine when not using –option runtime when code signing.

Yes, I know that. But as far as I know, it is not possible to use AppWrapper for Notarizing. (the –option runtime is not available).

A replacement of the AppleScript for the Finder was mentioned a couple of times. Search for NSWorkspaceMBS.

Yes, this is correct. But it doesn’t seems to work that way when your app is Notarized.
For example:

Declare Function obj_allocateClassPair Lib “libobjc.a.dylib” (superclass as Ptr, name as Cstring, extraBytes as Integer) As ptr

This works fine. Even when you codesign your app.
But when you codesign with –option runtime (needed for notarising) it does not work and throws an error:

An exception of class
FunctionNotFoundException was not
handled. The application must shut down.

Replacing it with the below code, it works fine.

Declare Function obj_allocateClassPair Lib “Cocoa” (superclass as Ptr, name as Cstring, extraBytes as Integer) As ptr

Yes, that’s true. Still, it is important to know it does not work anymore when your app has been notarised. That’s what this thread is all about: LIMITATIONS WHEN YOUR APP IS NOTARISED.

And for what’s worth: It is not possible with NSWorkSpace to show a file in the Finder. That’s what the above AppleEvent code does.

This is the function, I use it (but not with Notorized apps) activateFileViewerSelectingURLs: | Apple Developer Documentation

Here an excerpt from the documentation on the “–option runtime” flag (which requires macOS 10.13.6 or Mojave).

So any declares MUST now access the framework (not dylibs directly) that Apple declares is the most appropriate.
Sadly it now means that macOS 10.13.6 or newer must be used to deploy apps, and as I’m halfway through a project there isn’t a hope in hell that I’ll update my production machine to High Sierra or Mojave (until at least 10.14.3 or even 10.14.6), see how it goes. So looks like I’ll be using a second machine to deploy apps.

Sure is this possible:

NSWorkspaceMBS.selectFile(file)

[quote=410900:@Beatrix Willius]Sure is this possible:

NSWorkspaceMBS.selectFile(file)

Mea Culpa. :slight_smile:

Still, I need Applescript - which I currently cannot get to work with Notarising.

I think that Apple doesn’t want us to script the Finder anymore. Have you tried with an AppleScript for another app like Mail?

No, it’s extended to all the AppleScript. There is an example in the WWDC presentation that shows that trying to control Mail will show an alert to the user.

No, thats another thing. Mojave does indeed ask for permission when you use for example the Finder with Applescript. We all are aware of this now.

The above issue is that it just doesnt work at all when the app is notarized. It is possible we need to use an entitlement for this but I have no clue which.

Yes, for example removing a file with Applescript does not work when the app is notarized.

I see.
Probably we have to test with different hardened runtime entitlements

The writing has been on the wall for Apple Script for a long time; after all iOS doesn’t have it, so why should the macOS?

My advice is to find API to replace what you need (if possible), so what do you script the finder to do.

  • Show a file in the Finder, is covered with NSWorkspace API.
  • Removing a file, see one of my xDevMag articles where I write up how to delete files in the macOS, with the option to move them to the trash, so the user can recover them. I forget which edition.

[quote=410917:@Sam Rowlands]

  • Removing a file, see one of my xDevMag articles where I write up how to delete files in the macOS, with the option to move them to the trash, so the user can recover them. I forget which edition.[/quote]

As far as I know it is only possible to remove a file with the Finder AND keep the ‘Put Back’ feature enabled/working.
I have yet to find a different solution for this.

I’d agree with that except for the fact that Apple keeps adding things to the language. For instance, they added one for switching Dark Mode on and off in Mojave.