Background: A lot of rn front-end or Android side friends are not familiar with iOS packaging, so I write a graphic tutorial version, currently MY corresponding version is 0.4+ version and 0.5+ version (anyway, I also write randomly, reference mainly).

PS: account application and all kinds of certificate application I will not mention, baidu search.

1. Open the iOS folder in the project and create a folder named bundle

2. Open the terminal and go to the root directory of the entire project

3. Enter the command line. The command varies according to the version

If you have index.ios.js, use the following command

react-native bundle --entry-file index.ios.js --bundle-output ./ios/bundle/index.ios.jsbundle --platform ios --assets-dest ./ios/bundle --dev false
Copy the code

If you’re index.js, it’s a new version. Use this command

react-native bundle --entry-file index.js --bundle-output ./ios/bundle/index.jsbundle --platform ios --assets-dest ./ios/bundle --dev false
Copy the code

4. Enter the command and press Enter

The wait could be a while

4. Make up, almost missed a note

You may have a side project that has a WebView hosting HTML pages

At this point you may want to pay attention to the package typed from the command line

So in the picture below, THIS is the assets folder inside the Bundle folder

Actually how many files do I have in this HTML

What do you do when you find something missing? Simply go to your project and copy the relevant missing files into assets

5. Open the Xcode project

Just drag it over

Make sure you choose the one below, the blue physical folder

It looks like this

6. Open the AppDelegate (I’ve changed something, the code inside is the same, but my location is different, you can see)

Replace the source of jsCodeLocation with the source of your package (I don’t know how other people package, debug, and develop, but I do, and there are already two projects on the shelf, so I’m sure they work)

Index.ios. js as usual

 jsCodeLocation = [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:@"index.ios.jsbundle" ofType:nil]];
Copy the code

Index. Js to fill

 jsCodeLocation = [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:@"index.jsbundle" ofType:nil]];
Copy the code

7. All that’s left is the normal iOS packaging

The e picture starts to pack, at this time there are 4 options, because a package takes a long time I will not screen shots. Next steps in a few options we can baidu iOS packaging to understand. Or MAYBE I’ll pack a complement next time