We have an OS X app. In the ‘applicationDidFinishLaunching’ delegate we are loading a C++ dylib(uses OpenGL) using ‘dlopen’ and then calling a function in the library which blocks the main thread. Hence the ‘applicationDidFinishLaunching’ method does not return.The app works fine from within Xcode but the archive crashes.
Please advise.
The crash log is as below:-
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [6680]
VM Regions Near 0:
-->
__TEXT 0000000106b56000-0000000106b6e000 [ 96K] r-x/r-x SM=COW /Users/USER/Library/Developer/Xcode/Archives/2020-03-06/YePP sibi analyst 6-3-20, 2.09 pm.xcarchive/Products/Applications/YePP sibi analyst.app/Contents/MacOS/YePP sibi analyst
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 000000000000000000 0 + 0
1 com.yepp.sibiAnalyst 0x0000000106b5853f -[ControllerAppDelegate applicationDidFinishLaunching:] + 997 (ControllerAppDelegate.m:71)
2 com.apple.CoreFoundation 0x00007fff3c1d335f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
3 com.apple.CoreFoundation 0x00007fff3c1d32f3 ___CFXRegistrationPost1_block_invoke + 63
4 com.apple.CoreFoundation 0x00007fff3c1d3268 _CFXRegistrationPost1 + 372
5 com.apple.CoreFoundation 0x00007fff3c1d2ebe ___CFXNotificationPost_block_invoke + 97
6 com.apple.CoreFoundation 0x00007fff3c1a27e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1575
7 com.apple.CoreFoundation 0x00007fff3c1a1c82 _CFXNotificationPost + 1351
8 com.apple.Foundation 0x00007fff3e827a22 -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
9 com.apple.AppKit 0x00007fff393aafef -[NSApplication _postDidFinishNotification] + 312
10 com.apple.AppKit 0x00007fff393aad32 -[NSApplication _sendFinishLaunchingNotification] + 208
11 com.apple.AppKit 0x00007fff393a7df3 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 549
12 com.apple.AppKit 0x00007fff393a7a39 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 688
13 com.apple.Foundation 0x00007fff3e853246 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308
14 com.apple.Foundation 0x00007fff3e8530b0 _NSAppleEventManagerGenericHandler + 98
15 com.apple.AE 0x00007fff3d557092 0x7fff3d54a000 + 53394
16 com.apple.AE 0x00007fff3d5567b9 0x7fff3d54a000 + 51129
17 com.apple.AE 0x00007fff3d54ea27 aeProcessAppleEvent + 449
18 com.apple.HIToolbox 0x00007fff3ad432b8 AEProcessAppleEvent + 54
19 com.apple.AppKit 0x00007fff393a1e4c _DPSNextEvent + 1670
20 com.apple.AppKit 0x00007fff393a0380 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
21 com.apple.AppKit 0x00007fff3939209e -[NSApplication run] + 658
22 com.apple.AppKit 0x00007fff39364465 NSApplicationMain + 777
23 libdyld.dylib 0x00007fff738817fd start + 1