NSInvalidArgumentException on iOS


As briefly as possible:

I can test our app on Android devices without an issue from my main development box using

cordova run android

with a device attached to the machine.

I have set up an iMac to do iOS builds, and I have a git server in-house where we are doing version control. The repo is cloned locally on the mac for iOS builds, and the build is successful, but I get an NSInvalidArgumentException when running the application. Details below:

Ionic Info (from iMac):

cli packages: (/Users/tech/Documents/CRM-Mobile/Mobile-CRM-App/node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0


    Node  : v6.11.3
    npm   : 3.10.10 
    OS    : macOS Sierra
    Xcode : Xcode 8.3.3 Build version 8E3004b 

Error log from xCode:

2017-09-13 11:09:56.523 Advanced Tissue Mobile CRM[11813:1034988] [CDVTimer][ionicdeploy] 1.779020ms
2017-09-13 11:09:56.523 Advanced Tissue Mobile CRM[11813:1034988] [CDVTimer][ioniccordovacommon] 0.063002ms
2017-09-13 11:09:56.524 Advanced Tissue Mobile CRM[11813:1034988] [CDVTimer][keyboard] 1.022041ms
2017-09-13 11:09:56.547 Advanced Tissue Mobile CRM[11813:1034988] [CDVTimer][splashscreen] 23.117959ms
2017-09-13 11:09:56.551 Advanced Tissue Mobile CRM[11813:1034988] [CDVTimer][statusbar] 3.825009ms
2017-09-13 11:09:56.552 Advanced Tissue Mobile CRM[11813:1034988] [CDVTimer][keyboard] 0.005007ms
2017-09-13 11:09:56.552 Advanced Tissue Mobile CRM[11813:1034988] [CDVTimer][TotalPluginStartup] 33.408999ms
2017-09-13 11:09:56.780 Advanced Tissue Mobile CRM[11813:1034988] uuid is: 5da23921-feb4-4fc5-b99f-5ac5102353d7
2017-09-13 11:09:56.780 Advanced Tissue Mobile CRM[11813:1034988] ignore version: NOTHING_TO_IGNORE
2017-09-13 11:09:56.785 Advanced Tissue Mobile CRM[11813:1035011] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument'
*** First throw call stack:
	0   CoreFoundation                      0x000000010a555b0b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x0000000109f91141 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010a5be625 +[NSException raise:format:] + 197
	3   Foundation                          0x0000000109a7f05c -[NSRegularExpression(NSMatching) enumerateMatchesInString:options:range:usingBlock:] + 219
	4   Foundation                          0x0000000109a7ef6f -[NSRegularExpression(NSMatching) matchesInString:options:range:] + 151
	5   Advanced Tissue Mobile CRM          0x0000000109099ed5 __25-[IonicDeploy doRedirect]_block_invoke + 1301
	6   libdispatch.dylib                   0x000000010d3a54a6 _dispatch_call_block_and_release + 12
	7   libdispatch.dylib                   0x000000010d3ce05c _dispatch_client_callout + 8
	8   libdispatch.dylib                   0x000000010d3ac94f _dispatch_queue_serial_drain + 221
	9   libdispatch.dylib                   0x000000010d3ad669 _dispatch_queue_invoke + 1084
	10  libdispatch.dylib                   0x000000010d3adb32 _dispatch_queue_override_invoke + 654
	11  libdispatch.dylib                   0x000000010d3afec4 _dispatch_root_queue_drain + 634
	12  libdispatch.dylib                   0x000000010d3afbef _dispatch_worker_thread3 + 123
	13  libsystem_pthread.dylib             0x000000010d83b5a2 _pthread_wqthread + 1299
	14  libsystem_pthread.dylib             0x000000010d83b07d start_wqthread + 13
libc++abi.dylib: terminating with uncaught exception of type NSException

Any help would be greatly appreciated. Like I said, the app runs fine in Android development scenarios, but iOS builds are still a problem


Same issue here. ‘*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument’


I was ultimately able to get this to work by uninstalling and reinstalling the platform on my iMac, so:

ionic cordova platform rm ios
ionic cordova platform add ios


I have this exact issue. Are you using Ionic Deploy in the new Ionic Pro? I have added and removed my ios platform several times. Can you let me know what version of ios platform you have added?


I’m having the exact problem, using Ionic Deploy… if I choose to disable live update when running the app on ios for the first time the app seems to work fine, but I have to get the app working with the live update feature !


Note even with an empty starter app this happens. The problem is in IonicDeploy.m. If anyone finds a fix please post!


BTW to anyone following this - deploy works fine on android devices - just fails on ios.


for me it stuck on android too, didn’t debug to see what it is actually that causing it to stuck