Cordova iOS 3.7.0问题 - [__ NSCFString JSONObject]:无法识别的选择器

arc*_*man 3 cordova

我的应用程序适用于Cordova iOS 3.6.3.但是对于iOS 3.7.0,我收到错误,应用程序无法启动.这是我在模拟器中的日志中看到的唯一信息:

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
Run Code Online (Sandbox Code Playgroud)

谢谢,

Dav*_*ess 21

如果删除-ObjC链接器开关,则会出现此问题.libCordova.a库指定NSString上的一些类别,如果-ObjC删除它们将不会加载.

解决方法是从链接的框架中删除libCordova.a并将其添加到Other Linker Flags构建设置:

-force_load $(BUILT_PRODUCTS_DIR)/libCordova.a

这将导致libCordova.a中的所有符号(包括类别)在保持-ObjC关闭的同时被加载.