Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

ios18 crash reason: '*** -[__NSArrayM insertObjects:count:atIndex:]: attempt to insert nil object from objects[126976]'

Recently, my application has been receiving a lot of crashes every day, appearing on the iOS18 system. I can't find where the problem is and how can I solve it?

Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]

Date/Time:           2025-03-10 14:55:49.541 +0800
OS Version:          iOS 18.3.1 (22D72)
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000 at 0x0000000000000000
Triggered by Thread:  1

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObjects:count:atIndex:]: attempt to insert nil object from objects[126976]'

Thread 0:
0   libsystem_kernel.dylib        	0x00000001e95c4788 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	0x00000001e95c7e98 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	0x00000001e95c7db0 mach_msg_overwrite + 424
3   libsystem_kernel.dylib        	0x00000001e95c7bfc mach_msg + 24
4   CoreFoundation                	0x0000000197ee3804 0x197e6d000 + 485380
5   CoreFoundation                	0x0000000197ee2eb0 0x197e6d000 + 482992
6   CoreFoundation                	0x0000000197f35284 CFRunLoopRunSpecific + 588
7   GraphicsServices              	0x00000001e51a14c0 GSEventRunModal + 164
8   UIKitCore                     	0x000000019aa7e674 0x19a690000 + 4122228
9   UIKitCore                     	0x000000019a6a4e88 UIApplicationMain + 340
10  MyApp                       	0x0000000102dbfd70 main + 104
11  (null)	0x00000001be18dde8 0x0 + 7484268008

Thread 1 name:  com.apple.uikit.xpc-service
Thread 1 Crashed:
0   CoreFoundation                	0x0000000197e9a5fc 0x197e6d000 + 185852
1   libobjc.A.dylib               	0x0000000195415244 objc_exception_throw + 88
2   CoreFoundation                	0x0000000197ed46bc 0x197e6d000 + 423612
3   CoreFoundation                	0x0000000197ed37b0 0x197e6d000 + 419760
4   CoreFoundation                	0x0000000197e7f5f8 0x197e6d000 + 75256
5   MyApp                        	0x0000000103e4d4c0 startup_check_root + 12380
6   libdispatch.dylib             	0x000000019fc2d248 0x19fc2b000 + 8776
7   libdispatch.dylib             	0x000000019fc2efa8 0x19fc2b000 + 16296
8   libdispatch.dylib             	0x000000019fc365cc 0x19fc2b000 + 46540
9   libdispatch.dylib             	0x000000019fc37124 0x19fc2b000 + 49444
10  libdispatch.dylib             	0x000000019fc4238c 0x19fc2b000 + 95116
11  libdispatch.dylib             	0x000000019fc41bd8 0x19fc2b000 + 93144
12  libsystem_pthread.dylib       	0x0000000222c04680 _pthread_wqthread + 288
13  libsystem_pthread.dylib       	0x0000000222c02474 start_wqthread + 8
Answered by DTS Engineer in 829014022

Consider the crashing thread backtrace:

Thread 1 name:  com.apple.uikit.xpc-service
Thread 1 Crashed:
0   CoreFoundation          … 0x197e6d000 + 185852
1   libobjc.A.dylib         … objc_exception_throw + 88
2   CoreFoundation          … 0x197e6d000 + 423612
3   CoreFoundation          … 0x197e6d000 + 419760
4   CoreFoundation          … 0x197e6d000 + 75256
5   MyAppXX                 … startup_check_root + 12380
6   libdispatch.dylib       … 0x19fc2b000 + 8776
7   libdispatch.dylib       … 0x19fc2b000 + 16296
8   libdispatch.dylib       … 0x19fc2b000 + 46540
9   libdispatch.dylib       … 0x19fc2b000 + 49444
10  libdispatch.dylib       … 0x19fc2b000 + 95116
11  libdispatch.dylib       … 0x19fc2b000 + 93144
12  libsystem_pthread.dylib … _pthread_wqthread + 288
13  libsystem_pthread.dylib … start_wqthread + 8

Frames 13 through 6 suggest that this is a Dispatch worker thread running a block on a queue. Frame 5 is your code. Frames 4 through 2 suggest that your code has call Foundation [1]. Frames 1 and 0 are part of the standard exception machinery, indicating that Foundation has thrown a language exception, probably the attempt to insert nil object exception from the Application Specific Information section.

To debug this you need to identify the code in frame 5. This says startup_check_root, but with a large offset, so that’s not to be trusted. I recommend that you manually symbolicate this, using the instructions in Adding identifiable symbol names to a crash report. That should give you a source file and line number, and you can check that to see if the language exception in the Application Specific Information makes sense in that context.

Share and Enjoy

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

[1] Or Core Foundation, but that’s less likely these days.

Archive with xcode15.2

crash reports:

Consider the crashing thread backtrace:

Thread 1 name:  com.apple.uikit.xpc-service
Thread 1 Crashed:
0   CoreFoundation          … 0x197e6d000 + 185852
1   libobjc.A.dylib         … objc_exception_throw + 88
2   CoreFoundation          … 0x197e6d000 + 423612
3   CoreFoundation          … 0x197e6d000 + 419760
4   CoreFoundation          … 0x197e6d000 + 75256
5   MyAppXX                 … startup_check_root + 12380
6   libdispatch.dylib       … 0x19fc2b000 + 8776
7   libdispatch.dylib       … 0x19fc2b000 + 16296
8   libdispatch.dylib       … 0x19fc2b000 + 46540
9   libdispatch.dylib       … 0x19fc2b000 + 49444
10  libdispatch.dylib       … 0x19fc2b000 + 95116
11  libdispatch.dylib       … 0x19fc2b000 + 93144
12  libsystem_pthread.dylib … _pthread_wqthread + 288
13  libsystem_pthread.dylib … start_wqthread + 8

Frames 13 through 6 suggest that this is a Dispatch worker thread running a block on a queue. Frame 5 is your code. Frames 4 through 2 suggest that your code has call Foundation [1]. Frames 1 and 0 are part of the standard exception machinery, indicating that Foundation has thrown a language exception, probably the attempt to insert nil object exception from the Application Specific Information section.

To debug this you need to identify the code in frame 5. This says startup_check_root, but with a large offset, so that’s not to be trusted. I recommend that you manually symbolicate this, using the instructions in Adding identifiable symbol names to a crash report. That should give you a source file and line number, and you can check that to see if the language exception in the Application Specific Information makes sense in that context.

Share and Enjoy

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

[1] Or Core Foundation, but that’s less likely these days.

ios18 crash reason: '*** -[__NSArrayM insertObjects:count:atIndex:]: attempt to insert nil object from objects[126976]'
 
 
Q