我最近从1.24更新到ReactNativeControllers 2.03。我也将RN更新为0.25。我正在使用仅添加Podspec文件的叉子。在整理完RN中的所有导入更改之后,我现在为这个错误而感到困惑:
(另请参阅https://github.com/wix/react-native-controllers/issues/59)
使用3个参数调用了RCCManager.setRootController,但是期望使用2个参数。如果您自己尚未更改此方法,则通常意味着您的本机代码和JavaScript代码版本不同步。两者都更新应该使该错误消失。
有问题的代码:
在RCCManagerModule.m
:
setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps)
并在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 install
和pod install
。
我已经重建了Xcode项目。仍然没有运气。我不知道如何进一步调试。
编辑:我还试图清理Pod缓存,已更新为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.
花费很多时间努力工作,这一点后,我发现有一个过时的静态库libReactNativeControllers.a
在build/Products/Debug-iphonesimulator
。
删除libReactNativeControllers.a
并重建项目解决了该问题。
似乎Pod静态库现在被保存在各自的文件夹中,例如 build/Products/Debug-iphonesimulator/ReactNativeControllers/libReactNativeControllers.a
我的猜测是,最近的构建将静态库保存在子文件夹中,但是链接器选择了过期的库。有人知道为什么最近可能会改变吗?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句