Ios – React Native version mismatch 0.59.1 > 0.61.2

iosreact-native

After upgrading react-native from 0.59.10 to 0.61.2 the app does not load. It's stuck on the splash screen and giving me a version mismatch.

XCode logs showing:

JavaScript version: 0.59.1
Native version: 0.61.2-undefined

(I find the 'undefined' part above also quite strange)

I've tried the following:

  • Removing node modules;
  • Removing Pods and reinstalling;
  • watchman watch-del-all && react-native start –reset-cache;
  • Checked through my project for any 0.59.10 versions (nothing found);
  • Made sure all my terminal windows were closed;
  • Used react-native-clean-project;
  • Uninstalled app in Simulator;
  • Reinstalled the Xcode simulator.

package.json

{
  "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

    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-native log-ios

    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

    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-native run-ios

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-native info

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

Any help is welcome if you need any more information please ask.

Update

It seems to be an Xcode Simulator debug mode issue. When I set the app with stage set to release and launch it on an actual device/simulator, it builds correctly.

Best Answer

After creating a new bundle.js with "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=true --platform='ios'", it worked.

Update

This fix above only fixed a part of the issue. I noticed that after manually creating the iOS bundle, React Native did not create a new bundle on load/refresh. That was my first clue which reminded me in some changes I made in AppDelegate.m:

#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif

After changing back the else statement to what I had before return [CodePush bundleURL]; it fixed the issue. I'm not sure what caused me to change it in the first place, I think it was the Codepush documentation.

Related Topic