首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >反应本机版本错配0.59.1 > 0.61.2

反应本机版本错配0.59.1 > 0.61.2
EN

Stack Overflow用户
提问于 2019-10-09 08:29:31
回答 5查看 7.9K关注 0票数 8

升级后反应-本机从0.59.10到0.61.2,应用程序不加载。它被粘在了飞溅的屏幕上,给了我一个版本错配。

XCode日志显示:

代码语言:javascript
复制
JavaScript version: 0.59.1
Native version: 0.61.2-undefined

(我觉得上面的“未定义”部分也很奇怪)

我试过以下几种方法:

  • 删除节点模块;
  • 拆下吊舱和重新安装;
  • 守望者手表模型所有和反应-本机启动-复位-缓存;
  • 检查我的项目的任何0.59.10版本(什么都没有发现);
  • 确保我所有的终端窗户都关闭了;
  • 使用反应-本机-清洁项目;
  • 在模拟器中卸载应用程序;
  • 重新安装Xcode模拟器。

package.json

代码语言:javascript
复制
{
  "name": "-",
  "ios_version": "1.2.21",
  "android_version": "1.2.21",
  "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.2.1",
    "@react-native-community/netinfo": "^3.2.1",
    "axios": "^0.18.0",
    "bugsnag-react-native": "^2.23.2",
    "d3-scale": "^3.0.0",
    "d3-shape": "^1.3.5",
    "i18n-js": "^3.3.0",
    "lodash.memoize": "^4.1.2",
    "lottie-ios": "^3.1.3",
    "lottie-react-native": "^3.2.1",
    "moment": "^2.24.0",
    "native-base": "^2.12.1",
    "prettier": "^1.17.1",
    "prop-types": "^15.7.2",
    "qs": "^6.7.0",
    "react": "16.9.0",
    "react-devtools-core": "github:msand/react-devtools-core#4c30959",
    "react-native": "0.61.2",
    "react-native-clean-project": "^3.2.4",
    "react-native-code-push": "^5.6.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^1.1.4",
    "react-native-onesignal": "^3.4.2",
    "react-native-permissions": "^2.0.2",
    "react-native-rate": "^1.1.7",
    "react-native-restart": "0.0.12",
    "react-native-safari-view": "^2.1.0",
    "react-native-shimmer-placeholder": "^1.0.30",
    "react-native-splash-screen": "^3.2.0",
    "react-native-svg": "^9.3.5",
    "react-native-svg-charts": "^5.2.0",
    "react-native-touch-id": "^4.4.1",
    "react-navigation": "4.0.10",
    "react-redux": "^6.0.1",
    "redux": "^4.0.1",
    "redux-axios-middleware": "^4.0.0",
    "redux-thunk": "^2.3.0"
  },
  "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-test-renderer": "16.9.0",
    "eslint-config-rallycoding": "^3.2.0",
    "reactotron-react-native": "^3.6.4",
    "reactotron-redux": "^3.1.1"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./src/assets/fonts/"
    ]
  }
}

podfile

代码语言:javascript
复制
    platform :ios, '9.0'
    require_relative '../node_modules/@react-native-community/cli-platform- 
    ios/native_modules'
    project 'cryptohopperMobile',
      'Debug' => :debug,
      'Staging' => :release,
      'Release' => :release

    target '-' do
      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-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 'BugsnagReactNative', path: '../node_modules/bugsnag-react-native'

      permissions_path = '../node_modules/react-native-permissions/ios'
      pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"

      target 'OneSignalNotificationServiceExtension' do
        pod 'OneSignal', '>= 2.9.3', '< 3.0'
      end

      target '-Tests' do
        inherit! :search_paths
        # Pods for testing
      end

      use_native_modules!
    end

    target '--tvOS' do
      # Pods for tvOS
      target '-tvOSTests' do
        inherit! :search_paths
        # Pods for testing
      end
    end

react本机日志-ios

代码语言:javascript
复制
    NOTE:  Most system logs have moved to a new logging system.  See log(1) for more information.
    Oct  9 09:59:50 MBP-van-Kevin com.apple.CoreSimulator.SimDevice.A503B1AD-A2E6-4B6A-8BB0-8B836CDBB65A[27392] (com.apple.intents.intents-helper) <Warning>: Unknown key for Boolean: EnableTransactions
    Oct  9 09:59:50 MBP-van-Kevin com.apple.CoreSimulator.SimDevice.A503B1AD-A2E6-4B6A-8BB0-8B836CDBB65A[27392] (com.apple.intents.intents-helper) <Warning>: Unknown key for Boolean: EnablePressuredExit
    Oct  9 09:59:50 MBP-van-Kevin com.apple.CoreSimulator.SimDevice.A503B1AD-A2E6-4B6A-8BB0-8B836CDBB65A[27392] (com.apple.uifoundation-bundle-helper) <Warning>: Unknown key for Boolean: EnableTransactions
    Oct  9 09:59:50 MBP-van-Kevin com.apple.CoreSimulator.SimDevice.A503B1AD-A2E6-4B6A-8BB0-8B836CDBB65A[27392] (com.apple.uifoundation-bundle-helper) <Warning>: Unknown key for Boolean: EnablePressuredExit
    Oct  9 09:59:50 MBP-van-Kevin com.apple.CoreSimulator.SimDevice.A503B1AD-A2E6-4B6A-8BB0-8B836CDBB65A[27392] (com.apple.mobileslideshow.PhotosFileProvider[28289]) <Error>: assertion failed: 18G87: launchd_sim + 63769 [8D9B6CF1-070B-38FD-B74A-774E187D3032]: 0x16
    Oct  9 10:00:50 MBP-van-Kevin druid[28917] <Error>: assertion failed: 18G87 16G73: libxpc.dylib + 80528 [5846A329-63C0-3B4F-BC91-F30AF4CA6E30]: 0x7d
    Oct  9 10:00:50 MBP-van-Kevin Unknown[28917] <Error>:
    Oct  9 10:00:52 MBP-van-Kevin launchd_sim[27392] <Notice>: BUG in libdispatch client: mach_recv, monitored resource vanished before the source cancel handler was invoked { 0x7fb270a0bfa0[source], ident: 257795 / 0x3ef03, handler: 0x10b03c2d6 }
    Oct  9 10:01:07 MBP-van-Kevin cryptohopper_mobile[29274] <Error>: assertion failed: 18G87 16G73: libxpc.dylib + 80528 [5846A329-63C0-3B4F-BC91-F30AF4CA6E30]: 0x7d
    Oct  9 10:01:07 MBP-van-Kevin Unknown[29274] <Error>:

XCode logs

代码语言:javascript
复制
    2019-10-09 10:03:36.746016+0200 cryptohopper_mobile[31428:128970] libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.
    2019-10-09 10:03:36.900263+0200 cryptohopper_mobile[31428:128970] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/kevinetore/Library/Developer/CoreSimulator/Devices/3356B7C4-EFA4-4639-B6EA-631D56E67BB5/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
    2019-10-09 10:03:36.900578+0200 cryptohopper_mobile[31428:128970] [MC] Reading from private effective user settings.
    2019-10-09 10:03:36.917791+0200 cryptohopper_mobile[31428:129053] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
    2019-10-09 10:03:36.917908+0200 cryptohopper_mobile[31428:129053] Cannot start load of Task <2C82020D-9EB0-4B61-B918-E0495956134D>.<1> since it does not conform to ATS policy
    2019-10-09 10:03:36.918088+0200 cryptohopper_mobile[31428:129051] Task <2C82020D-9EB0-4B61-B918-E0495956134D>.<1> finished with error - code: -1022
    2019-10-09 10:03:36.960 [info][tid:main][RCTRootView.m:293] Running application cryptohopper_mobile ({
        initialProps =     {
        };
        rootTag = 1;
    })
    2019-10-09 10:03:36.967546+0200 cryptohopper_mobile[31428:128970] ERROR: Error! iOS Simulator does not support push! Please test on a real iOS device. Error: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator}
    2019-10-09 10:03:37.099 [error][tid:com.facebook.react.JavaScript] React Native version mismatch.

    JavaScript version: 0.59.1
    Native version: 0.61.2-undefined

    Make sure that you have rebuilt the native code. If the problem persists try clearing the Watchman and packager caches with `watchman watch-del-all && react-native start --reset-cache`.
    2019-10-09 10:03:37.148 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 's.Manager')
    2019-10-09 10:03:37.150 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 's.Manager')
    2019-10-09 10:03:37.152 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
    2019-10-09 10:03:37.201 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Module AppRegistry is not a registered callable module (calling runApplication)

react本机运行-ios

代码语言:javascript
复制
warn Your project is using deprecated "rnpm" config that will stop working from next release. Please use a "react-native.config.js" file to configure the React Native CLI. Migration guide: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - react-native-code-push: https://microsoft.github.io/code-push
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - bugsnag-react-native (to unlink run: "react-native unlink bugsnag-react-native")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Found Xcode workspace "cryptohopperMobile.xcworkspace"
info Building (using "xcodebuild -workspace cryptohopperMobile.xcworkspace -configuration Debug -scheme cryptohopperMobile -destination id=A503B1AD-A2E6-4B6A-8BB0-8B836CDBB65A -derivedDataPath build/cryptohopperMobile")
............................................................
info Installing "build/cryptohopperMobile/Build/Products/Debug-iphonesimulator/cryptohopper_mobile.app"
info Launching "com.cryptohopper"
success Successfully launched the app on the simulator

react本机信息

代码语言:javascript
复制
Binaries:
    Node: 12.11.1 - /usr/local/bin/node
    npm: 6.11.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.2 => 0.61.2
  npmGlobalPackages:
    react-native-cli: 2.0.1

欢迎任何帮助,如果您需要更多的信息,请询问。

更新

这似乎是Xcode模拟器调试模式的问题。当我用舞台设置程序发布并在一个实际的设备/模拟器上启动它时,它的构建是正确的。

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2019-10-14 10:06:18

在用bundle.js创建了一个新的"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=true --platform='ios'"之后,它就成功了。

更新

以上修正只解决了部分问题。我注意到,在手动创建iOS包之后,在加载/刷新时没有创建新的包。这是我的第一条线索,在我对AppDelegate.m所做的一些改变中提醒了我

代码语言:javascript
复制
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif

在将else语句改为return [CodePush bundleURL];之前的语句后,它修复了这个问题。我不知道是什么原因导致我首先改变了它,我认为是Codepush文档造成的。

票数 3
EN

Stack Overflow用户

发布于 2019-10-09 08:55:17

  • 如果您的项目不是很大,您可以保存*.js文件,并使重新生成本机init
  • 但是,如果需要保存项目的结构,则可以迁移 用升级助手
票数 0
EN

Stack Overflow用户

发布于 2019-10-10 09:33:56

显然,您需要在项目子句旁边的Podfile中添加类似的添加。这将有效地配置用于调试或发布的方案。在这方面,RNv.60.x似乎有一些重大变化,特别是如果您有多个方案和/或使用了react本机方案-管理器。

代码语言:javascript
复制
project 'NameOfYourProject',
'Debug' => :debug,
'Release' => :release,
'FooDebug' => :debug,
'FooRelease' => :release

有关更多详细信息,请参见

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58300004

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档