React-native: Update instructions to run app on iOS device using offline bundle

Created on 5 Aug 2016  路  13Comments  路  Source: facebook/react-native

The instructions in the documentation to run the app on iOS device using an offline bundle says

Open ios/YourApp/AppDelegate.m
Uncomment the line, jsCodeLocation = [[NSBundle mainBundle] ...

Using latest version 0.30.0, such line is no longer present in the default AppDelegate.m file. Below is the excerpt from the default AppDelegate.m file

 NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"TestAppDelete"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];

If I try to copy over the line from an old application and use that, I see that jsCodeLocation is returned as null.

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

Have these instructions changed? What are the new instructions to run the app using an offline bundle?

Ran Commands Locked

Most helpful comment

Refer to the accepted answer for this stackoverflow question. The instructions for running the app on the device have changed but they are yet to be updated on the documentation.

All 13 comments

I have the same problem.

I need also a solution

Refer to the accepted answer for this stackoverflow question. The instructions for running the app on the device have changed but they are yet to be updated on the documentation.

The stackoverflow post is the solution. Now its working. An update of the React Native Documentation is required.

Please raise the priority. The situation is pretty bad...

The current react-native documentation reads:

1. Open ios/YourApp/AppDelegate.m
2. Uncomment the line, jsCodeLocation = [[NSBundle mainBundle] ...

That's inaccurate.

Apparently there is some hidden trick involving adding ip.txt to your XCode project:
React Native 0.29+ without dev mode in iOS?

It's also pretty unclear to me how one should integrate CodePush with RCTBundleURLProvider, see https://github.com/Microsoft/react-native-code-push/issues/393

Please update the documentation ASAP. Thx!

@tiemevanveen I don't agree that the docs are fixed. I am still seeing that note about uncommenting the jsCodeLocation:

screen shot 2016-09-06 at 9 47 37 am

No not yet, but will be in the next release. You can already see the "next" documentation in the link I posted

Yes, you are right. Looks better. Will ip.txt be eventually documented as well?

@facebook-github-bot label Icebox

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/update-instructions-to-run-app-on-ios-device-using-offline-bundle

ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub.

Also, if this issue is a bug, please consider sending a PR with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.

@facebook-github-bot close

@charpeni tells me to close this issue. If you think it should still be opened let us know why.

Was this page helpful?
0 / 5 - 0 ratings