Crash report with line zero in my code

Hi there,
My app has a strange crash in the [MyView myViewNameForUsername:] function. I put logs in this function to print the 'Username' value but no logs. It looks the function crashes early.
Please explain what the zero line (MyView.m:0) means in in the crash report generated by the Objective-C code:
Code Block Incident Identifier: B36765F0-9E9F-4FD1-9BE5-2932AC2C93C5
CrashReporter Key: 0000000000000000000000000000000000000000
Hardware Model: iPad11,7
Process: APP_Name [2003]
Identifier: com.app.id
Version: 10.2.0
Code Type: arm64e
Date/Time: 2021-04-26T09:41:23-07:00
Launch Time: 2021-04-26T09:41:23-07:00
OS Version: iOS 14.4.2 (18D70)
Report Version: 105
Exception Type: NSInvalidArgumentException
Exception Subtype: -[_NSInlineData stringByAppendingString:]: unrecognized selector sent to instance 0x282fd90e0
Thread 0 name:
Thread 0 Crashed:
0 CoreFoundation 0x000000019bcf686c __exceptionPreprocess (CoreFoundation)
1 libobjc.A.dylib 0x00000001b0d0fc50 objc_exception_throw (libobjc.A.dylib)
2 CoreFoundation 0x000000019bbfd95c -[NSOrderedSet initWithSet:copyItems:] (CoreFoundation)
3 CoreFoundation 0x000000019bcf9438 ___forwarding___ (CoreFoundation)
4 CoreFoundation 0x000000019bcfb740 _CF_forwarding_prep_0 (CoreFoundation)
5 APP_Name 0x0000000104e9c270 +[MyView myViewNameForUsername:] (MyView.m:0)
6 APP_Name 0x000000010510ea54 -[MyViewRequestModel initWithUserName:tableView:delegate:] (MyViewRequestModel.m:0)
7 APP_Name 0x000000010515c024 -[ItemsManagerModel init] (ItemsManagerModel.m:84)
8 APP_Name 0x00000001050f43c0 -[ItemsViewController init] (ItemsViewController.m:40)
9 APP_Name 0x0000000104f3dfb0 -[AppNameNavigationController loadItems] (AppNameNavigationController.m:476)
10 CoreFoundation 0x000000019bc539a0 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (CoreFoundation)
11 CoreFoundation 0x000000019bc53948 ___CFXRegistrationPost_block_invoke (CoreFoundation)
12 CoreFoundation 0x000000019bc52eb0 _CFXRegistrationPost (CoreFoundation)
13 CoreFoundation 0x000000019bc52870 _CFXNotificationPost (CoreFoundation)
14 APP_Name 0x0000000104e3fcb8 -[MyEvent postObject:forName:] (MyEventWrapper.m:43)
15 APP_Name 0x0000000105186b24 -[HomeScreenButtonGridModel cellPressed:] (HomeScreenButtonGridModel.m:215)
16 APP_Name 0x00000001052da9a4 -[HomeScreenCollectionViewCell buttonTapped:] (HomeScreenCollectionViewCell.m:24)
17 UIKitCore 0x000000019e6b2e78 -[UIApplication sendAction:to:from:forEvent:] (UIKitCore)
18 UIKitCore 0x000000019dfe9ef0 -[UIControl sendAction:to:forEvent:] (UIKitCore)
19 UIKitCore 0x000000019dfea244 -[UIControl _sendActionsForEvents:withEvent:] (UIKitCore)
20 UIKitCore 0x000000019dfe8aa8 -[UIControl touchesEnded:withEvent:] (UIKitCore)
21 UIKitCore 0x000000019e1ec84c _UIGestureEnvironmentUpdate (UIKitCore)
22 UIKitCore 0x000000019e1ea9e0 -[UIGestureEnvironment _updateForEvent:window:] (UIKitCore)
23 UIKitCore 0x000000019e6f2e30 -[UIWindow sendEvent:] (UIKitCore)
24 UIKitCore 0x000000019e6cc1d4 -[UIApplication sendEvent:] (UIKitCore)
25 UIKitCore 0x000000019e7560ec __dispatchPreprocessedEventFromEventQueue (UIKitCore)
26 UIKitCore 0x000000019e7590a4 __processEventQueue (UIKitCore)
27 UIKitCore 0x000000019e750550 __eventFetcherSourceCallback (UIKitCore)
28 CoreFoundation 0x000000019bc7276c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ (CoreFoundation)
29 CoreFoundation 0x000000019bc72668 __CFRunLoopDoSource0 (CoreFoundation)
30 CoreFoundation 0x000000019bc71960 __CFRunLoopDoSources0 (CoreFoundation)
31 CoreFoundation 0x000000019bc6ba8c __CFRunLoopRun (CoreFoundation)
32 CoreFoundation 0x000000019bc6b21c CFRunLoopRunSpecific (CoreFoundation)
33 GraphicsServices 0x00000001b3835784 GSEventRunModal (GraphicsServices)
34 UIKitCore 0x000000019e6abee8 -[UIApplication _run] (UIKitCore)
35 UIKitCore 0x000000019e6b175c UIApplicationMain (UIKitCore)
36 APP_Name 0x0000000104d16718 main (main.m:17)
37 libdyld.dylib 0x000000019b92b6b0 start (libdyld.dylib)


Accepted Reply

I assume that all Obj-c code is processed by [Clang]

Right, but that’s not what I was aiming for. [Sorry about the wording there; on rereading it today I can totally understand your confusion.] My point is that not all instructions generated by the compiler are directly mapped to a line of source code. You most commonly see this in Swift, where the compiler generates a lot of code on your behalf. For example, consider this code:

Code Block
class NetworkManager: NSObject, URLSessionTaskDelegate {
… lots of other code …
func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {
… your method implementation …
}
}


[Sorry this is Swift but it’s much easier to illustrate this issue this way.]

If you disassemble the code you’ll see two NetworkManager.urlSession(_:taskIsWaitingForConnectivity:) methods:
  • The first is the code that you wrote.

  • The second is a thunk generated by the compiler to convert between the Objective-C calling conventions used by NSURLSession and the Swift calling conventions used by your code.

If you crash in the second code then there is no matching source file and line number because that code was generated by the compiler.

Finally, while the above example is from Swift the Objective-C compiler can do the same thing, it’s just harder to trigger.



Notwithstanding all of the above, the fact that this is happening on two consecutive frames suggest that this isn’t compiler-generated code but rather some ‘lost’ symbols.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Replies

Please explain what the zero line (MyView.m:0) means in in the crash
report generated by the Objective-C code:

It means that the symbolicator was unable to map the address in the frame (0x0000000104e9c270) to a line of code. This can happen for a variety of reasons, for example, the code in question was generated by the compiler. However, given that you have two frames like this back to back (frames 5 and 6) it seems likely that this is failing because the symbolicator doesn’t have access to the symbols for your MyView subsystem.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Hi Eskimo,
You mentioned one example "the code ... was generated by the compiler." I assume that all Obj-c code is processed by the com.apple.compilers.llvm.clang.1_0 compiler and generates an object code of some lower-level programming language. Is there another way to generate the object code? Can you provide a document where is described?

I assume that all Obj-c code is processed by [Clang]

Right, but that’s not what I was aiming for. [Sorry about the wording there; on rereading it today I can totally understand your confusion.] My point is that not all instructions generated by the compiler are directly mapped to a line of source code. You most commonly see this in Swift, where the compiler generates a lot of code on your behalf. For example, consider this code:

Code Block
class NetworkManager: NSObject, URLSessionTaskDelegate {
… lots of other code …
func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {
… your method implementation …
}
}


[Sorry this is Swift but it’s much easier to illustrate this issue this way.]

If you disassemble the code you’ll see two NetworkManager.urlSession(_:taskIsWaitingForConnectivity:) methods:
  • The first is the code that you wrote.

  • The second is a thunk generated by the compiler to convert between the Objective-C calling conventions used by NSURLSession and the Swift calling conventions used by your code.

If you crash in the second code then there is no matching source file and line number because that code was generated by the compiler.

Finally, while the above example is from Swift the Objective-C compiler can do the same thing, it’s just harder to trigger.



Notwithstanding all of the above, the fact that this is happening on two consecutive frames suggest that this isn’t compiler-generated code but rather some ‘lost’ symbols.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"