8

Anyone could you please explain how to generate offline bundle of iOS application from 'react native' code?

I have already tried How to generate .ipa file for react-native? but it is not working.

Don Branson
  • 13,631
  • 10
  • 59
  • 101

3 Answers3

34
react-native run-ios --configuration=release

Will run your app on Simulator or Device with the bundle.

Or just build it from Xcode (release build always includes the bundle) Or run the debug release but before that, you should :

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

Also, new react-native versions index.ios.js not found because of we need run this,

react-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --platform ios
errorau
  • 2,121
  • 1
  • 14
  • 38
Ata Mohammadi
  • 3,430
  • 6
  • 41
  • 69
  • 1
    How to enable the debug release? Is it `scheme > build configuration > release`? – Stanislav Mayorov Feb 11 '19 at 09:48
  • @StanislavMayorov If you wanna debug a release build, better to have crash reporting like Sentry.io – Ata Mohammadi Feb 19 '19 at 15:05
  • If you get an error that main.jsbundle does not exist after running `react-native run-ios --configuration Release`, make sure that you do not have any whitespace characters in your project path. The bundler command does not handle whitespace characters well. So change a project path like `/users/bob/project world domination` to `/users/bob/project-world-domination` – Nicolai Lissau Jul 24 '19 at 08:45
5

I am assuming you wish to run the app on a ios device without deploying it into the app store. If that is the case then:

First I would make sure I have ios-deploy installed.

You can do so by running npm install -g ios-deploy

Then connect the iphone you want the app to be installed in into your mac.

Then run

react-native run-ios --device "XYZ’s iPhone" --configuration=release

This would create a offline js bundled app and install it onto the iphone.

PS: If it errors out saying

Signing for "<app name>" requires a development team. 
Select a development team in the project editor.

Then open up the project inside ios/ in Xcode and Select the target -> General Tab Under signing choose the signing team and choose automatically manage signing.

Then save and re-run the command.

Atul
  • 2,170
  • 23
  • 24
1

Method 1

Step one:

react-native bundle --entry-file index.ios.js --bundle-output ./ios/main.jsbundle --platform ios

Step two:

react-native run-ios --configuration=release 

This worker for me.

Method 2 use xcode and change debug to release, like this: enter image description here

kenmistry
  • 1,934
  • 1
  • 15
  • 24
hook zou
  • 581
  • 5
  • 6
  • method 1 did not work for me. It just created the bundle, started the simulator, and threw an error "No Bundle URL present" – Ryan Jan 26 '21 at 22:48