I recently developed a Mac app that runs perfectly fine on my machine, but crashes on one of my beta tester's. I've been sent the crash report, but I honestly have no idea how to decipher the issue. From what I can tell, the salient issue is described in the Global Trace Buffer:
Global Trace Buffer (reverse chronological seconds):
18446744049.082520 CFNetwork 0x00007fff8882acdf TCP Conn 0x7fee28674dc0 started
18446744049.124989 CFNetwork 0x00007fff887ee86b Creating default cookie storage with default identifier
18446744049.124989 CFNetwork 0x00007fff887ee836 Faulting in CFHTTPCookieStorage singleton
18446744049.124989 CFNetwork 0x00007fff887ee6c5 Faulting in NSHTTPCookieStorage singleton
And the exception description:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
However, thread 0 says the following:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.charliecarver.Sightings 0x000000010afb8907 0x10af3d000 + 506119
1 com.charliecarver.Sightings 0x000000010afb5e95 0x10af3d000 + 495253
2 com.apple.CoreFoundation 0x00007fff91108c9c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
3 com.apple.CoreFoundation 0x00007fff91108c2f ___CFXRegistrationPost_block_invoke + 63
4 com.apple.CoreFoundation 0x00007fff91108ba7 _CFXRegistrationPost + 407
5 com.apple.CoreFoundation 0x00007fff91108912 ___CFXNotificationPost_block_invoke + 50
6 com.apple.CoreFoundation 0x00007fff910c56d2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
7 com.apple.CoreFoundation 0x00007fff910c4925 _CFXNotificationPost + 693
8 com.apple.Foundation 0x00007fff9810f0fa -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
9 com.apple.AppKit 0x00007fff900b6ea1 -[NSApplication _postDidFinishNotification] + 297
10 com.apple.AppKit 0x00007fff900b6c0b -[NSApplication _sendFinishLaunchingNotification] + 203
11 com.apple.AppKit 0x00007fff8ff71dc1 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 557
12 com.apple.AppKit 0x00007fff8ff7186b -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 250
13 com.apple.Foundation 0x00007fff9815da8d -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 290
14 com.apple.Foundation 0x00007fff9815d907 _NSAppleEventManagerGenericHandler + 102
15 com.apple.AE 0x00007fff89c4e1b5 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 531
16 com.apple.AE 0x00007fff89c4df3c dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 31
17 com.apple.AE 0x00007fff89c4de58 aeProcessAppleEvent + 288
18 com.apple.HIToolbox 0x00007fff99f2bef5 AEProcessAppleEvent + 55
19 com.apple.AppKit 0x00007fff8ff6d230 _DPSNextEvent + 2245
20 com.apple.AppKit 0x00007fff8ff6c1c5 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
21 com.apple.AppKit 0x00007fff8ff60d28 -[NSApplication run] + 682
22 com.apple.AppKit 0x00007fff8ff29fbe NSApplicationMain + 1176
23 com.charliecarver.Sightings 0x000000010afb7019 0x10af3d000 + 499737
24 libdyld.dylib 0x00007fff998435ad start + 1
Does this actually have to do with "Faulting in NSHTTPCookieStorage singleton"? How would I go about debugging this?
Edit:
I was able to symbolicate the crash log and saw this:
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fff773dad90 rbx: 0x0000000000000000 rcx: 0x00007fff78c65c58 rdx: 0x0040000000000000
rdi: 0x00007fff788aea50 rsi: 0x00007fff914c7a02 rbp: 0x00007fff54cc1450 rsp: 0x00007fff54cc13f0
r8: 0x0000000000000000 r9: 0x00007fee2866e8b0 r10: 0x00007fee28892620 r11: 0x00007fff78c65c58
r12: 0x00007fff788aea50 r13: 0x0000000000000000 r14: 0x00007fff78abbb20 r15: 0x00007fee28665440
rip: 0x000000010afb8907 specialized AppDelegate.applicationDidFinishLaunching(NSNotification) -> () (in Sightings) (AppDelegate.swift:60)
Line 60 of my code looks like this:
sortMenu.itemWithTag(tag)?.state = NSOnState
Is that the culprit?
Edit 2:
I commented out itemWithTag and ran it on his machine again, and this time the app crashed at this line:
shareMenu.addItem(menuItem)
None of this is making sense to me, but it's only crashing (so far, at least) around code related to NSMenus...