ios - Xcode 11 Module AppRegistry 不是注册的可调用模块(调用 runApplication)

标签 ios react-native

我最近(痛苦地)从react-native 0.59.10升级到0.61.2,当我通过Xcode 11构建并运行时,启动画面会加载,但控制台中会显示错误,并且应用程序不会加载。

我已经尝试过:

cd ios && rm -rf Pods && pod 缓存清理 --all && pod install && cd ..

react-native 包 --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

并再次干净安装了react-native,但没有成功。

package.json

{
  "name": "my_app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "clean": "react-native-clean-project"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "moment": "^2.22.1",
    "native-base": "^2.12.1",
    "react": "16.9.0",
    "react-native": "0.61.2",
    "react-native-config": "^0.11.5",
    "react-native-clean-project": "^3.2.4",
    "react-native-nfc-manager": "^0.4.2",
    "react-native-pagination": "^1.2.8",
    "react-native-permissions": "^1.2.1",
    "react-native-splash-screen": "^3.2.0",
    "react-navigation": "^1.5.11",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-thunk": "^2.2.0",
    "scheduler": "^0.16.2",
    "urijs": "^1.19.1"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-native-clean-project": "^3.2.4",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native",
    "transform": {
      "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    }
  }
}

Podfile

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'my_app' do
  use_frameworks!

  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

  target 'my_appTests' do
    inherit! :complete
    # Pods for testing
  end


  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
    end
  end
end

我希望我的应用程序能够加载,但我收到以下错误:

    2019-10-16 10:25:06.379 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Native module cannot be null.
    2019-10-16 10:25:06.381 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Native module cannot be null.
    2019-10-16 10:25:06.388 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
    2019-10-16 10:25:06.390 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

最佳答案

解决了我的问题。升级中缺少未自动添加到 Podfile 的依赖项。作为引用,就我而言,它是:

pod 'react-native-nfc-manager', :path => '../node_modules/react-native-nfc-manager/'
pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'

关于ios - Xcode 11 Module AppRegistry 不是注册的可调用模块(调用 runApplication),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58419109/

相关文章:

react-native - 自定义标签栏 React 导航 5

ios - 键盘分辨率低

c# - MvvmCross: UICollectionView 点击后执行命令

java - react-native android bundle 错误 keystore 加载 : keystore password was incorrect

android - 使用电子邮件在 react-native 中收集表单数据

reactjs - React Native 在 React context API 和 useState Hook 中更新状态

reactjs - 使用 Redux-Saga 如何保存我的身份验证 token ?

ios - 使用 PushNotificationIOS 时没有已知的选择器类方法

ios - EXC_BAD_ACCESS code=1 UIScrollView 捏合手势崩溃

iOS UIView 转换,容器 View 创建问题