简体   繁体   中英

How can I create a release build of my bare React Native app without using “expo publish” and pushing updates to my users?

I'm new to React Native development. I created a React Native app using expo. I ended up ejecting it to the bare workflow. All good so far. I was able to build an app bundle for Android and an.ipa for iOS. I used "expo publish" to update the code/bundle before building the app and deploying it on both app stores.

While developing the app further at a later time I typed "expo publish" because I wanted to build a stand-alone bundle to test a release build. I kept getting cached versions on my release builds and expo publish seemed to be the only thing that would update my release builds. I didn't realize this was pushing an OTA update to all my users. I thought it was just pushing the updates to the expo servers where I could opt in or out of OTA updates. Fortunately it worked out ok.

Now, I have developed the app further. On iOS the debug build is fine. However I can't get an updated bundle on iOS release build. I get old code. Why? I don't understand the process. I even tried this script:

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

I thought this was going to build a new "updated" bundle. No luck. I even deleted my main.jsbundle file from the ios directory and rebuilt it but still got old code.

I don't want to use OTA updates. I just want to build a stand alone app. What am I doing wrong and how can I get around it? This has been a very frustrating process.

Definitely start using release channels, eg staging and production to protect your users. You can publish to these specifically like

expo publish --release-channel staging

and likewise you can build to those channels, eg

expo build:ios --release-channel staging

The expo docs explain it well: https://docs.expo.io/distribution/release-channels/#publish-with-channels

Finally, since you're in Bare Workflow checkout this recent blog from the Expo team about updates to the OTA improvements

https://blog.expo.io/over-the-air-updates-from-expo-are-now-even-easier-to-use-376e2213fabf

Of interest to you might be the line "This new (release build) update will not be published automatically and will exist only in the binary with which it was bundled"

OTA updates are great, but you need to understand how they work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM