React-native: Issues bundling the app for production in RN 0.35

Created on 13 Oct 2016  路  8Comments  路  Source: facebook/react-native

Issue Description

React Native (on 0.35) app fails to pick up offline bundle on my local machine OR build with the new RCTBundleURLProvider snippet.

This is running in the "Release" scheme.

When trying to load the offline bundle (command react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output iOS/main.jsbundle), it spits out:

2016-10-13 16:59:08.489 [fatal][tid:main] No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle.unsanitizedScriptURLString:((null))

The bundle is in the correct directory and is in the XCode project. I am correctly signing the app w/ fastlane under the correct appstore provisioning profiles.

Steps to Reproduce / Code Snippets

Two different AppDelegate snippets I have tried:

#ifdef DEBUG
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
#else
  jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

Expected Results

I would expect it to build successfully. With the first AppDelegate snippet posted above, it correctly loads in the "Debug" scheme.

Additional Information

  • React Native version: 0.35
  • Platform(s) (iOS, Android, or both?): iOS
  • Operating System (macOS, Linux, or Windows?): macOS
Locked

Most helpful comment

Seeing this as well working with the CLI. @arjunblj could you share your solution?

All 8 comments

I began to experience this issue today, seemingly out of nowhere. Have you found a solution @arjunblj?

Yes, I just solved this issue. For some reason, the meta file was not included.

Yes, please, I have this problem also. What is the meta file?

Seeing this as well working with the CLI. @arjunblj could you share your solution?

Don't know if this will help anyone but this was driving me nuts and the following worked for me . . .

  1. Closed dev server
  2. Cleaned project
  3. Build

At this point I got a new error, one of my modules had the same name as one of the in-built RN modules. So I renamed that and it all worked.

I have encountered exactly with the same problem, Any help please!

React Native version: 0.39.2
Platform: iOS
Operating System: macOS
Xcode: 8.0

@pan100 and for whoever else finds this - meta file is when you run

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

it will generate both a main.jsbundle and main.jsbundle.meta file

I had the same problem with React Native 0.42 when integrating it in an existing iOS/swift app.
Solved in this way:

  • Create the bundle running command specified by @pan100
  • Add the main.jsbundle file to your XCode project (XCode>File>Add File to "MyProject").
  • Load the bundle in your swift controller in this way:
    let jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURLForBundleRoot("index.ios", fallbackResource: nil)
  • Run on the Device
Was this page helpful?
0 / 5 - 0 ratings