• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ios - Javascript/Native 代码不同步(参数数量不同)错误

[复制链接]
菜鸟教程小白 发表于 2022-12-13 16:59:16 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我最近从 1.24 更新到 ReactNativeControllers 2.03。我还将 RN 更新为 0.25。我正在使用仅添加 Podspec 文件的 fork。在整理出 RN 中的所有导入更改后,我现在被这个错误难住了:

(另见 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:

setRootControllerNSDictionary*)layout animationTypeNSString*)animationType globalPropsNSDictionary*)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 删除了 watchman 缓存。我已经删除了我的 node_modules 文件夹,完成了 npm installpod 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.



Best Answer-推荐答案


在花了很多时间试图解决这个问题后,我发现 build/Products/Debug-iphonesimulator 中有一个过时的静态库 libReactNativeControllers.a

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

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

我的猜测是最近的构建将静态库保存在子文件夹中,但链接器正在选择过时的库。任何人都知道为什么这可能最近发生了变化?

关于ios - Javascript/Native 代码不同步(参数数量不同)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37749590/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap