3
votes

I'm deploying a build to testers via TestFlight and the app is crashing. I cannot reproduce the crash on my end so I am trying to rely on the crash logs listed in Xcode Organizer.

Unfortunately the crashes here contain some information, but nothing that allows me to identify the line of code that is causing the crash. Usually when I click on a crash in the Organizer window, it automatically shows me the line in Xcode that caused the crash.

Here's the raw crash log, which also does not contain a line number, only the file and method in which the crash occured.

Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib              0x0000000103154b8c 0x102f64000 + 2034572
1   libswiftCore.dylib              0x0000000103154b8c 0x102f64000 + 2034572
2   libswiftCore.dylib              0x000000010316017c 0x102f64000 + 2081148
3   libswiftCore.dylib              0x0000000103105cfc 0x102f64000 + 1711356
4   libswiftCore.dylib              0x0000000103160984 0x102f64000 + 2083204
5   libswiftCore.dylib              0x00000001030ad2f8 0x102f64000 + 1348344
6   AppName                         0x0000000102c92748 specialized TableViewController.sendSmsMessage(sender:) + 8816 (TableViewController.swift:0)

(TableViewController.swift:0)
7   AppName                         0x0000000102c8c448 @objc TableViewController.CorF(sender:) + 44
8   UIKitCore                       0x00000001ea7a6314 -[UIApplication sendAction:to:from:forEvent:] + 96 (UIApplication.m:4786)
9   UIKitCore                       0x00000001ea233d54 -[UIControl sendAction:to:forEvent:] + 80 (UIControl.m:624)
10  UIKitCore                       0x00000001ea234074 -[UIControl _sendActionsForEvents:withEvent:] + 440 (UIControl.m:707)
11  UIKitCore                       0x00000001ea233074 -[UIControl touchesEnded:withEvent:] + 568 (UIControl.m:461)
12  UIKitCore                       0x00000001ea7dfa6c -[UIWindow _sendTouchesForEvent:] + 2472 (UIWindow.m:2204)
13  UIKitCore                       0x00000001ea7e0cd0 -[UIWindow sendEvent:] + 3156 (UIWindow.m:2453)
14  UIKitCore                       0x00000001ea7bffcc -[UIApplication sendEvent:] + 340 (UIApplication.m:10819)
15  UIKitCore                       0x00000001ea88ee38 __dispatchPreprocessedEventFromEventQueue + 1620 (UIEventDispatcher.m:1678)
16  UIKitCore                       0x00000001ea891830 __handleEventQueueInternal + 4740 (UIEventDispatcher.m:1937)
17  UIKitCore                       0x00000001ea88a320 __handleHIDEventFetcherDrain + 152 (UIEventDispatcher.m:1905)
18  CoreFoundation                  0x00000001bd44a0e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1980)
19  CoreFoundation                  0x00000001bd44a060 __CFRunLoopDoSource0 + 88 (CFRunLoop.c:2015)
20  CoreFoundation                  0x00000001bd449944 __CFRunLoopDoSources0 + 176 (CFRunLoop.c:2051)
21  CoreFoundation                  0x00000001bd444810 __CFRunLoopRun + 1040 (CFRunLoop.c:2922)
22  CoreFoundation                  0x00000001bd4440e0 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
23  GraphicsServices                0x00000001bf6bd584 GSEventRunModal + 100 (GSEvent.c:2245)
24  UIKitCore                       0x00000001ea7a4c00 UIApplicationMain + 212 (UIApplication.m:4347)
25  AppName                         0x0000000102c7d0f0 main + 60 (SMS.swift:12)
26  libdyld.dylib                   0x00000001bcf02bb4 start + 4

Any idea on how I can determine the line that is causing the crash?

EDIT: I was able to get the user to send me a crash report stored on their device as suggested by @Václav, but it doesn't seem to contain much helpful information either:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libswiftCore.dylib              0x0000000104e774ec 0x104c8c000 + 2012396
1   libswiftCore.dylib              0x0000000104e774ec 0x104c8c000 + 2012396
2   libswiftCore.dylib              0x0000000104e828cc 0x104c8c000 + 2058444
3   libswiftCore.dylib              0x0000000104e28fd4 0x104c8c000 + 1691604
4   libswiftCore.dylib              0x0000000104e830cc 0x104c8c000 + 2060492
5   libswiftCore.dylib              0x0000000104dd142c 0x104c8c000 + 1332268
6   AppName                         0x00000001047fa948 0x1047e0000 + 108872
7   AppName                         0x00000001047f4784 0x1047e0000 + 83844
8   UIKitCore                       0x00000001e6fe6314 0x1e66fc000 + 9347860
9   UIKitCore                       0x00000001e6a73d54 0x1e66fc000 + 3636564
10  UIKitCore                       0x00000001e6a74074 0x1e66fc000 + 3637364
11  UIKitCore                       0x00000001e6a73074 0x1e66fc000 + 3633268
12  UIKitCore                       0x00000001e6bfaaf0 0x1e66fc000 + 5237488
13  UIKitCore                       0x00000001e6bf57ec 0x1e66fc000 + 5216236
14  UIKitCore                       0x00000001e6bf52cc 0x1e66fc000 + 5214924
15  UIKitCore                       0x00000001e6bf509c 0x1e66fc000 + 5214364
16  UIKitCore                       0x00000001e7020cb4 0x1e66fc000 + 9587892
17  UIKitCore                       0x00000001e6ffffcc 0x1e66fc000 + 9453516
18  UIKitCore                       0x00000001e70cee38 0x1e66fc000 + 10300984
19  UIKitCore                       0x00000001e70d1830 0x1e66fc000 + 10311728
20  UIKitCore                       0x00000001e70ca320 0x1e66fc000 + 10281760
21  CoreFoundation                  0x00000001b9c8a0e0 0x1b9bdd000 + 708832
22  CoreFoundation                  0x00000001b9c8a060 0x1b9bdd000 + 708704
23  CoreFoundation                  0x00000001b9c89944 0x1b9bdd000 + 706884
24  CoreFoundation                  0x00000001b9c84810 0x1b9bdd000 + 686096
25  CoreFoundation                  0x00000001b9c840e0 0x1b9bdd000 + 684256
26  GraphicsServices                0x00000001bbefd584 0x1bbef2000 + 46468
27  UIKitCore                       0x00000001e6fe4c00 0x1e66fc000 + 9341952
28  AppName                         0x00000001047e5860 0x1047e0000 + 22624
29  libdyld.dylib                   0x00000001b9742bb4 0x1b9742000 + 2996
1
So, your app crashes on real devices, after it is installed via TestFlight? And you cannot reproduce it on XCode Simulator, when you build & install it via XCode? Just to clarify.Václav
Check out stackoverflow.com/questions/53872700/…. Line 0 most likely means the compiler has generated code for you, and does not correspond to an actual line in your sources. Because of the specialized there, I'm inclined to believe this is the case here.Mattie
Set a breakpoint on offset 0x102c92748 and step through...l'L'l
I don't think, you can send Debug to TF. I am almost 100% sure, that TF forces release, as you said. You can build it on a real device, which you set to UK locale, and try to crash it, while connected to XCode and All Exceptions breakpoint on.Václav
@Václav, thats a great idea. Let me try.Mark Lyons

1 Answers

2
votes

There are a few different elements to this question, so let me try to break it down.

Why do I see line 0?

The Swift compiler does a fair amount of code generation before actually producing a final compiled binary. In this situation, line 0 is the compiler's way of telling you that it generated code while compiling TableViewController.swift, but that code doesn't correspond to a specific line in the original source.

Because you've got a specialized function here, I'm much more inclined to believe this is compiler-generated code. This usually means the compiler is working with generic types.

I'm disappointed that Apple communicates this event in this way, but there's not much we can do. My understanding is that DWARF can describe this kind of thing. But, either Apple doesn't use this facility, it isn't written to crash reports, or most likely both.

You can verify this behavior by using atos or dwarfdump to symbolication the address 0x0000000102c92748. My bet is it will output exactly the same thing - line 0. In the past I've used dwarfdump to poke around here to see if there was more info encoded in the dSYM, but I didn't find anything. It was a few years ago though, so things might have changed.

Might a 3rd party crash reporter help?

They all use the dSYM to symbolicate, so they cannot have more information than is contained in that file. It could be worth a shot, regardless, but I doubt you'll get anywhere on the line 0 thing.

However, they probably will be able to symbolicate the frames from libswiftCore.dylib, which could be very helpful.

Why did this crash happen?

This is the million dollar question.

I'd like to see the actual crash details. My guess is it is an illegal instruction, because you've crashed inside a swift runtime library. What's likely happening is the runtime has tripped on some kind of illegal state. Unwrapping a nil Optional could definitely be it. Could also be an out of bounds Range operation. I think that out-of-bounds array indexes might also fail in this way, but off the top of my head, I'm not sure.

What I would do is just take a close look at what's going on in TableViewController.sendSmsMessage(sender:). Pay close attention to the things listed above, particularly if it is interacting with any generic standard library functions.

I would also make an attempt to symbolicate those libswiftCore.dylib frames. Again, you can use atos for this, just by pointing it at the library itself and using the load address. I'm unsure where Xcode keeps the Swift libraries internally, so you might just use the copy of the lib that was bundled with your app.

Good luck!