Module AppRegistry is not a registered callable module only in Release configuration

半城伤御伤魂 提交于 2021-01-28 19:03:24

问题


Few days ago we had problem with our release build for IOS. We were getting

Module AppRegistry is not a registered callable module

error. In Debug configuration everything went well.


回答1:


After some time we found out that when you run your code in develop configuration your index.js is created and provisioned to device via localhost connection. But when you're in release, you use

react-native-xcode.sh

script as a build step in xcode. This script creates index.js for you. BIG problem is that if this script can't find your entry point to the application, it doesn't fail, it builds index.js successfully without any modules. In that case, just add entry point to your application to build step.




回答2:


my command line looked like: export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh ../index.js




回答3:


In you appDelegate find jsCodeLocation and then replace with below code.

   var jsCodeLocation : URL? = nil

  #if DEBUG
      jsCodeLocation = URL.init(string: "http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev=true")
    #else
      jsCodeLocation = CodePush.bundleURL()
    #endif

Basically app is not able to locate the bundler . In my case when bundler run it shows index.js instead of index.ios.js so modified the path accordingly that works for me



来源:https://stackoverflow.com/questions/48283521/module-appregistry-is-not-a-registered-callable-module-only-in-release-configura

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!