Terminating app due to uncaught exception 'NSInvalidArgumentException - ERROR BUG HELP!

Hi all!


My app has been running perfectly until I upgraded to Xcode 9 and I keep getting this error message:



2017-10-31 00:03:31.054133+0000 What Team[4057:403056] [DYMTLInitPlatform] platform initialization successful

2017-10-31 00:03:31.115719+0000 What Team[4057:402959] [Application] Failed to instantiate the default view controller for UIMainStoryboardFile 'MainStoryboard' - perhaps the designated entry point is not set?

2017-10-31 00:03:31.134559+0000 What Team[4057:402959] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles

2017-10-31 00:03:31.135299+0000 What Team[4057:402959] [MC] Reading from public effective user settings.

2017-10-31 00:03:31.137273+0000 What Team[4057:402959] [FYB Info]: Starting FyberSDK version 8.15.1

2017-10-31 00:03:31.146422+0000 What Team[4057:402959] Could not successfully update network info during initialization.

2017-10-31 00:03:31.147021+0000 What Team[4057:403047] Could not successfully update network info during initialization.

=================================================================

Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]

PID: 4057, TID: 403047, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 21

Backtrace:

4 What Team 0x0000000100457738 -[FYBOrientationProvider dictionaryWithKeyValueParameters] + 96

5 What Team 0x0000000100456e20 __45-[FYBURLGenerator setParametersFromProviders]_block_invoke + 36

6 CoreFoundation 0x0000000185432370 <redacted> + 224

7 What Team 0x0000000100456d70 -[FYBURLGenerator setParametersFromProviders] + 132

8 What Team 0x000000010045696c -[FYBURLGenerator stringOfEncodedParameters] + 64

9 What Team 0x0000000100456798 -[FYBURLGenerator generatedURLString] + 60

10 What Team 0x0000000100456890 -[FYBURLGenerator signedURLStringWithSecretToken:] + 68

11 What Team 0x0000000100456808 -[FYBURLGenerator signedURLWithSecretToken:] + 32

12 What Team 0x000000010048b380 -[FYBMediationConfigurationClient generateUrl] + 156

13 What Team 0x000000010048a4d8 __56-[FYBMediationConfigurationClient requestConfiguration:]_block_invoke + 320

14 libdispatch.dylib 0x00000001014d149c _dispatch_call_block_and_release + 24

15 libdispatch.dylib 0x00000001014d145c _dispatch_client_callout + 16

16 libdispatch.dylib 0x00000001014dd56c _dispatch_queue_override_invoke + 980

17 libdispatch.dylib 0x00000001014e2b54 _dispatch_root_queue_drain + 616

18 libdispatch.dylib 0x00000001014e2880 _dispatch_worker_thread3 + 136

19 libsystem_pthread.dylib 0x000000018517b130 _pthread_wqthread + 1268

20 libsystem_pthread.dylib 0x000000018517ac30 start_wqthread + 4

2017-10-31 00:03:31.150632+0000 What Team[4057:403047] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]

PID: 4057, TID: 403047, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 21

Backtrace:

4 What Team 0x0000000100457738 -[FYBOrientationProvider dictionaryWithKeyValueParameters] + 96

5 What Team 0x0000000100456e20 __45-[FYBURLGenerator setParametersFromProviders]_block_invoke + 36

6 CoreFoundation 0x0000000185432370 <redacted> + 224

7 What Team 0x0000000100456d70 -[FYBURLGenerator setParametersFromProviders] + 132

8 What Team 0x000000010045696c -[FYBURLGenerator stringOfEncodedParameters] + 64

9 What Team 0x0000000100456798 -[FYBURLGenerator generatedURLString] + 60

10 What Team 0x0000000100456890 -[FYBURLGenerator signedURLStringWithSecretToken:] + 68

11 What Team 0x0000000100456808 -[FYBURLGenerator signedURLWithSecretToken:] + 32

12 What Team 0x000000010048b380 -[FYBMediationConfigurationClient generateUrl] + 156

13 What Team 0x000000010048a4d8 __56-[FYBMediationConfigurationClient requestConfiguration:]_block_invoke + 320

14 libdispatch.dylib 0x00000001014d149c _dispatch_call_block_and_release + 24

15 libdispatch.dylib 0x00000001014d145c _dispatch_client_callout + 16

16 libdispatch.dylib 0x00000001014dd56c _dispatch_queue_override_invoke + 980

17 libdispatch.dylib 0x00000001014e2b54 _dispatch_root_queue_drain + 616

18 libdispatch.dylib 0x00000001014e2880 _dispatch_worker_thread3 + 136

19 libsystem_pthread.dylib 0x000000018517b130 _pthread_wqthread + 1268

20 libsystem_pthread.dylib 0x000000018517ac30 start_wqthread + 4

2017-10-31 00:03:31.152757+0000 What Team[4057:402959] DiskCookieStorage changing policy from 2 to 0, cookie file: file:/

2017-10-31 00:03:31.155919+0000 What Team[4057:402959] Could not successfully update network info during initialization.

2017-10-31 00:03:31.402864+0000 What Team[4057:402959] Reachability Flag Status: -R ------- networkStatusForFlags

2017-10-31 00:03:31.532836+0000 What Team[4057:402959] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

*** First throw call stack:

(0x18554fd38 0x184a64528 0x1854e8c44 0x18541c4b8 0x1003ad060 0x1003ac3d0 0x1003ad4b0 0x1003a24fc 0x18e9cf050 0x18ebc2898 0x18ebc76e4 0x18ee55454 0x18f1251f0 0x18ee550b8 0x18ee55928 0x18f5be6e8 0x18f5be58c 0x18f33a9c0 0x18f4cffc8 0x18f33a870 0x18f124850 0x18ebc5e28 0x18efc96ec 0x187bf1768 0x187bfa070 0x1014d145c 0x1014ddb74 0x187c25a04 0x187c256a8 0x187c25c44 0x1854f8358 0x1854f82d8 0x1854f7b60 0x1854f5738 0x1854162d8 0x1872a7f84 0x18e9c3880 0x10038f43c 0x184f3a56c)

libc++abi.dylib: terminating with uncaught exception of type NSException

Im not sure what the problem is, any help would be much appreciated thank you!

The direct cause of the crash you’re seeing is this:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

Some code is attempting to add

nil
into an
NSMutableArray
. That’s not supported, and attempting this causes
NSMutableArray
to throw a language exception.

The line after that shows the backtrace of the code that’s going this. It’s hard to garner much from a raw backtrace like this. However, if you grab the associated crash report and symbolicate that, it’ll give you a bunch of context for the issue.

For more information about getting and symbolicating crash reports, see Technote 2151 Understanding and Analyzing iOS Application Crash Reports.

Finally, this log line is worrying:

[reports] Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]

Someone in process is calling UIKit from a secondary thread. In this case the associated backtrace has symbols, so you should investigate from there.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

In addition to everything Quinn told you, your storyboard doesn't have the entry point view controller set, so it's not loading in the view controller from the storyboard. You'll need to fix that from interface builder by designating the "starting" view controller of your storyboard.

Thanks Quinn and Owen for your help and effort, I managed to fix it in the end, turns out I had a quiz level answer that contained 13 characters when the quiz only supports a maximum of 12 characters for any answer. I removed the offending answer and it worked like normal.


Once again your help and thoughts were much appreciated! 🙂

Terminating app due to uncaught exception 'NSInvalidArgumentException - ERROR BUG HELP!
 
 
Q