Since Mojave, i'm noticing odd behaviors when usijng NSWorkspace.openNURL, selectFile, and other APIs.
Very often (bit not consistently), these rwquests will simply hang indefinitely. I'm assuming this has to do with the new ockdowmn for AppleEvents & Co in Mojave. A typical hang will have this callstack — it doesn't matter whether i call openURL (& Co) on the main thread or ion a backgrous queue, it will hang (of course, calling it on main means ther whole app gangs) — looks like this:
F273
semaphore_wait_trap (libsystem_kernel.dylib)
_dispatch_sema4_wait (libdispatch.dylib)
_dispatch_semaphore_wait_slow (libdispatch.dylib)
_AppleEventsLookupApplicationPort (AE)
copyPortByPSN (AE)
EventAddress::copyAddressPort() const (AE)
AESendMessage (AE)
_LSAnnotateAndSendAppleEvent(AEDesc*, AEDesc const*, audit_token_t const*, _LSOpen2Options const*, NSError**) (LaunchServices)
_LSAnnotateAndSendAppleEvent(LSOpenState*, AEDesc*) (LaunchServices)
_LSOpenItemsWithHandler_CFDictionaryApplier(void const*, void const*, void*) (LaunchServices)
__CFDictionaryApplyFunction_block_invoke (CoreFoundation)
CFBasicHashApply (CoreFoundation)
CFDictionaryApplyFunction (CoreFoundation)
_LSOpenStuffCallLocal (LaunchServices)
_LSOpenStuff (LaunchServices)
_LSOpenURLsWithRole_Common (LaunchServices)
_LSOpenURLsWithRole_CommonLegacy(__CFArray const*, unsigned int, AEKeyDesc const*, LSApplicationParameters_V1 const*, _LSOpen2Options const*, ProcessSerialNumber*, long, __CFURL const**, unsigned char*) (LaunchServices)
LSOpenFromURLSpec (LaunchServices)
-[NSWorkspace openURL:] (AppKit)
I tried calling AEDeterminePermissionToAutomateTarget, but that *too* simply hangs. I do have a `NSAppleEventsUsageDescription` key in my Info.plist.
i notiuce then hang is more likewly to happen when my app is not codesigned (i.e. whiule working on it/debugging), while the (Developer ID) code-signed production build *mostly* works.
Is anyone else seeing this? Is this *expected* behavior (for non-signed apps, at least)? Am i missing something else that needs to be set/called?
thanx!
marc