React native release app packaged iOS app

Source: Internet
Author: User

After you've developed your app with react native, how do you publish it for your users? The release process of an app is no different: signing package, publish to each store these two steps. This article will share with you how to sign and package a react Native APP.

In this article I'll show you how to package and publish the React Native IOS App.

For the packaged React Native Android app, check out the signature pack apk for React Native release app

First step: Export JS bundle and picture Resources

Unlike the packaged react Native Android app, we can't export react Native iOS apps with the command step. We need to package the JS part of the code with the image resource, and then add it to the iOS project through Xcode.

command to Export JS bundle

Under the root directory of the React native project:

React-NativeBundle--Entry-FileIndexios. JS --platform ios --dev false -- Bundle-output release_ios/main jsbundle -- Assets-dest release_ios/  
    • 1
    • 1

With the above command, we can export the JS part of the Code and picture resources, such as packaging exported to the Release_ios directory:

Among them, assets for the project in the JS part of the image resources (not including the original module of the picture resources), Main.jsbundle is the JS part of the code.

Before we execute the package command, we need to make sure that we have a folder at the root of our project release_ios and create one without it.

Step two: Import JS bundle and picture resources into iOS project

In this step we need to use Xcode, select the Assets folder and the Main.jsbundle file to drag it to the Xcode project navigation panel.

Then, modify the APPDELEGATE.M file and add the following code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  NSURL *jsCodeLocation; //jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; +jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];#endif... return YES;}
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

The function of the above code is to let react native to use the jsbundle we just imported, so we have been freed from the reliance on the local NODEJS server.

Tip: If you use the Codepush hot update in your project, then we need to be able to read the local jsbundle directly through Codepush, as follows:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  NSURL *jsCodeLocation;  #ifdef DEBUG    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];#else    jsCodeLocation = [CodePush bundleURL];#endif... return YES;}
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

So far, we've imported JS bundle and image resources into our iOS project, and then we're ready to publish our iOS app.

Step three: Publish iOS apps

To publish an iOS app we need a $99 account to upload the app to AppStore, or $299 for an enterprise account to post the app to a server in your company or to a third-party company.

Next, we need to apply for AppID? Create an app at tunes connect? A wrapper? A few big steps to submit your app to the App Store.

Because there are detailed instructions in the official documentation, I'm not going to repeat it.

React native release app packaged iOS app

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.