2016-06-10 38 views
2

我最近更新到ReactNativeControllers 2.03从1.24。我也更新了RN到0.25。我正在使用仅添加Podspec文件的fork。整理出在RN我现在难倒这个错误的所有进口变化后:Javascript /本机代码不同步(参数数量不同)错误

(也https://github.com/wix/react-native-controllers/issues/59见)

RCCManager.setRootController was called with 3 arguments, but expects 2. If you haven't changed this method yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.

有问题的代码:

RCCManagerModule.m

setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps) 

and index.js

ControllerRegistry: { 
    registerController: function (appKey, getControllerFunc) { 
     _controllerRegistry[appKey] = getControllerFunc(); 
    }, 
    setRootController: function (appKey, animationType = 'none', passProps = {}) { 
     var controller = _controllerRegistry[appKey]; 
     if (controller === undefined) return; 
     var layout = controller.render(); 
     _validateDrawerProps(layout); 
     RCCManager.setRootController(layout, animationType, passProps); 
    } 
    }, 

显而易见,两者都有3个参数。

我已经杀死并重新启动打包程序。我已经清理了Xcode项目,包括派生数据,并删除了看守员缓存watchman watch-del-all。我删除了我的node_modules文件夹,完成了npm installpod install

我已经重建了Xcode项目。仍然没有运气。我不知道如何进一步调试。

编辑:我也试着清理荚缓存,更新的CocoaPods 1.01 ...

我有一种感觉,有可能在这里是一个红色的鲱鱼的地方。仅供参考我的完整跟踪看起来是这样的:

2016-06-10 14:15:18.179 [warn][tid:com.facebook.React.JavaScript] Warning: ReactNative.Component is deprecated. Use React.Component from the "react" package instead. 
2016-06-10 14:15:18.239 JustTuner[7523:185768] Launching Couchbase Lite... 
2016-06-10 14:15:19.048 JustTuner[7523:185768] Couchbase Lite url = http://adamwilsonsMBP.lan:5984/ 
2016-06-10 14:15:19.050 JustTuner[7523:185768] Launching Couchbase Lite... 
2016-06-10 14:15:19.058 JustTuner[7523:185768] Couchbase Lite url = http://adamwilsonsMBP.lan:5984/ 
2016-06-10 14:15:19.538 [error][tid:main][RCTModuleMethod.m:456] RCCManager.setRootController was called with 3 arguments, but expects 2.     If you haven't changed this method yourself, this usually means that     your versions of the native code and JavaScript code are out of sync.     Updating both should make this error go away. 

回答

2

花费很多时间努力工作,这一点后,我发现,在build/Products/Debug-iphonesimulator是一个过时的静态库libReactNativeControllers.a的。

删除libReactNativeControllers.a并重建项目解决了这个问题。

看来Pod静态库现在被保存在它们各自的文件夹中,例如build/Products/Debug-iphonesimulator/ReactNativeControllers/libReactNativeControllers.a

我的猜测是最近的版本是保存在子文件夹中的静态库,但链接器正在挑选过时的。任何人都知道为什么这可能最近改变了?

+4

有点偏离主题,但我希望有一个叫做XCode的大稻草人,我们可以每年都聚在一起烧掉它。喝一杯,然后互相哭泣。 – Trip