Cordova iOS 3.7.0 error - [__NSCFString JSONObject]: unrecognized selector
My app works fine with Cordova iOS 3.6.3. However, as of iOS 3.7.0, I get an error and the app won't start. This is the only information I can see in the logs in the emulator:
2014-11-23 23:55:21.149 App[68461:5278465] -[__NSCFString JSONObject]: unrecognized selector sent to instance 0x122db42b0
2014-11-23 23:55:21.151 App 68461:5278465] *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> -[__NSCFString JSONObject]: unrecognized selector sent to instance 0x122db42b0
2014-11-23 23:55:21.176 App[68461:5278465] -[__NSCFString JSONObject]: unrecognized selector sent to instance 0x122db4278
2014-11-23 23:55:21.176 App 68461:5278465] *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> -[__NSCFString JSONObject]: unrecognized selector sent to instance 0x122db4278
Thank,
source to share
This is a problem if you remove the linker switch -ObjC
. The libCordova.a library defines some categories in the NSString that will not load if -ObjC
removed.
We are working to remove libCordova.a from linked frameworks and add this to the build setting of other linkers:
-force_load $(BUILT_PRODUCTS_DIR)/libCordova.a
This will load all symbols (including categories) in libCordova.a on save -ObjC
.
source to share