如何处理 codepush 和 Google playstore / Apple appstore 之间的潜在竞争条件

How to handle potential race conditions between codepush and Google playstore / Apple appstore

我刚刚构建了我的第一个 React Native 应用程序,并且对通过 codepush 发送 OTA 更新的能力感到非常兴奋。但是,当我进行更改时,发布过程是什么样的。 想象一下发生以下情况:

v1 -> released to playstore
v2 -> bugfix: released via codepush
v3 -> native changes: released to playstore

从 google playstore 下载 v3 的用户,打开应用程序后,他会从 codepush 获得 v2 吗?我无法将 v3 推送到 codepush,因为它的本机更改可能会中断。

很奇怪 none 的 codepush 文章/文档涵盖了这种潜在的竞争条件?

您可以从 codepush 文档中看到以下文字 here

Target binary version parameter

This specifies the store/binary version of the application you are releasing the update for, so that only users running that version will receive the update, while users running an older and/or newer version of the app binary will not. This is useful for the following reasons:

1) If a user is running an older binary version, it's possible that there are breaking changes in the CodePush update that wouldn't be compatible with what they're running.

2) If a user is running a newer binary version, then it's presumed that what they are running is newer (and potentially incompatible) with the CodePush update. If you don't specify the targetBinaryVersion in the release command, it takes from the build.gradle (or) If you specify the target version, the current release would be mapped to it.

假设您有一个将通过 Play 商店发送给用户的新版本,可以推断版本代码和内部版本号将更新,并且较早的代码推送版本将不再指向此版本。

所以回答你的问题。

从 google playstore 下载 v3 的用户,打开应用程序后,他会从 codepush 获得 v2 吗?

不,他们不会得到它,因为代码推送版本将映射到较早的二进制版本

我无法将 v3 推送到 codepush,因为它的本机更改可能会中断。

您可以对市场上已有的 v3 进行更改