Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

After upgrading to React Native 0.60.5 iOS release build gives "No bundle URL present" error

$
0
0

I've just updated my project from React Native 0.59.9 to 0.60.5 with react-native upgrade and the update helper mentioned in the official blog post. Although my project is already a little "complex" because it's using some libraries etc. it seemed the update was successful.

But unfortunately my app won't work with the Test - Release scheme anymore. On the debug scheme it works without any problems. The release also reaches the "Build succeeded" status, but as soon the app launches it's stuck because of the "No bundle URL present" error (see also my attached Xcode screenshot).

I've tried everything I could find on the internet so far. Re-installing the NPM dependencies and Pods; removing the build folder, changing the NSAppTransportSecurity in the Info.plist, but it won't resolve the issue.. The deployed app via TestFlight breaks as well on startup.

React Native info

System:
    OS: macOS 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 430.30 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.11.0 - ~/.nvm/versions/node/v10.11.0/bin/node
    Yarn: 1.10.1 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.11.0/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
    Android SDK:
      API Levels: 23, 26, 28, 29
      Build Tools: 28.0.3, 29.0.0
      System Images: android-29 | Google APIs Intel x86 Atom
  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.60.5 => 0.60.5
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

  1. Update react-native from 0.59.9 to 0.60.5
  2. Remove node_modules, ios/Pods, ios/build and Podfile.lock
  3. Re-install node_modules and run pod install
  4. Open Project.xcworkspace
  5. Select the scheme "Project - Test" go to "Edit scheme > Run > Build Configuration" and change the scheme to "Test - Release"
  6. Build the project (on device or simulator, doesn't matter)
  7. "Build succeeded" and app starts
  8. App is stuck on splash screen and Xcode shows the error as in the attached screenshot

Files / Code

Currently these are my Info.plist, Podfile and package.json:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>Jobner</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>2</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>localhost</key>
            <dict>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>ITSAppUsesNonExemptEncryption</key>
    <false/>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Your location is required for searching jobs near you</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Your location is required for searching jobs near you</string>
  <key>LSApplicationQueriesSchemes</key>
  <array>
    <string>whatsapp</string>
  </array>
</dict>
</plist>
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

project 'Project',
  'Prod - Debug' => :debug,
  'Acc - Debug' => :debug,
  'Test - Debug' => :debug,
  'Prod - Release' => :release,
  'Acc - Release' => :release,
  'Test - Release' => :release

target 'Project' do
  # Pods for Project
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  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-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  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 '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'

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

  use_native_modules!
end
{
  "name": "project",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "lint": "eslint --ext .jsx --ext .js src/",
    "ios": "react-native run-ios --scheme \"Project - Test\" --configuration \"Test - Debug\"",
    "android": "ENVFILE=.env.dev react-native run-android --variant=devDebug --appIdSuffix=dev",
    "postinstall": "npx jetify"
  },
  "dependencies": {
    "@aws-amplify/auth": "1.2.31",
    "@aws-amplify/core": "1.1.0",
    "@babel/polyfill": "7.4.4",
    "@react-native-community/async-storage": "1.6.1",
    "accounting": "0.4.1",
    "amazon-cognito-identity-js": "3.0.15",
    "cross-fetch": "3.0.4",
    "dayjs": "1.8.15",
    "iban": "0.0.12",
    "prop-types": "15.7.2",
    "qs": "6.7.0",
    "react": "16.9.0",
    "react-geocode": "0.1.2",
    "react-native": "0.60.5",
    "react-native-android-keyboard-adjust": "^1.2.0",
    "react-native-bootsplash": "1.0.1",
    "react-native-config": "luggit/react-native-config#master",
    "react-native-datepicker": "1.7.2",
    "react-native-device-info": "2.3.2",
    "react-native-gesture-handler": "1.3.0",
    "react-native-keyboard-aware-scroll-view": "0.9.1",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-linear-gradient": "2.5.6",
    "react-native-pdf": "5.1.4",
    "react-native-svg": "9.8.4",
    "react-navigation": "3.11.0",
    "react-redux": "7.1.1",
    "redux": "4.0.4",
    "redux-devtools-extension": "2.13.8",
    "redux-thunk": "2.3.0",
    "reselect": "^4.0.0",
    "rn-fetch-blob": "0.10.16",
    "styled-components": "4.3.2"
  },
  "devDependencies": {
    "@babel/core": "7.5.5",
    "@babel/plugin-proposal-export-default-from": "7.5.2",
    "@babel/plugin-proposal-export-namespace-from": "7.5.2",
    "@babel/plugin-syntax-dynamic-import": "7.2.0",
    "@babel/runtime": "7.5.5",
    "babel-eslint": "10.0.2",
    "babel-plugin-module-resolver": "3.2.0",
    "babel-plugin-styled-components": "1.10.6",
    "eslint": "^5.16.0",
    "eslint-config-react-app": "^4.0.1",
    "eslint-import-resolver-babel-module": "5.1.0",
    "eslint-plugin-flowtype": "3.13.0",
    "eslint-plugin-import": "2.18.2",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-react": "7.14.3",
    "eslint-plugin-react-hooks": "1.6.1",
    "eslint-plugin-react-native": "3.7.0",
    "jetifier": "^1.6.4",
    "metro-react-native-babel-preset": "0.56.0"
  },
  "xcodeSchemes": {
    "Debug": [
      "Test - Debug",
      "Acc - Debug",
      "Prod - Debug"
    ],
    "Release": [
      "Test - Release",
      "Acc - Release",
      "Prod - Release"
    ],
    "projectDirectory": "ios",
    "settings": {}
  },
  "rnpm": {
    "assets": [
      "./src/app/static/fonts/"
    ]
  }
}

The AppDelegate.m should link to the correct bundle file right? This code is in there:


- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

(I posted this question/bug in the React Native issue tracker on Github as well.)

enter image description here

Edited:

I've found a solution in this Stack Overflow post. Following these steps you can create a main.jsbundle and assets folder and add it to your project.

  1. Run the following command: react-native bundle --dev false --platform ios --entry-file index.js --bundle-output ios/main.jsbundle --assets-dest ./ios
  2. Add main.jsbundle and assets directory to Xcode by dragging them in your project.

Although this feels like a temporary solution.. I've got two main.jsbundle files right now. Can I delete the one in my project folder? And the assets folder includes some node modules do I have this command every time I add new modules and manually drag the assets in my project root?

Also when I build it via CI/CD (Bitrise) there is no main.jsbundle created in the root since it is ignored by default in .gitignore. So my TestFlight builds are still failing. How to handle this?

What exactly is happening here?

enter image description here


Viewing all articles
Browse latest Browse all 16552

Trending Articles