2

我正在尝试使用 Electrode(Walmart - http://www.electrode.io/site/docs/introduction.html)创建一个基于 ReactNative 的基本 iOS 应用程序

虽然我可以让应用程序在我的 Mac 上本地运行,但我很难理解整个无线 (OTA) 更新可以/应该如何工作。

这是我到目前为止所做的

  • 使用 ern create-miniapp TestApp 创建了一个小应用
  • 在 BitBucket 上创建了一个 GIT 存储库
  • 使用 ern cauldron repo 添加 TestApp [Bitbucket-url] 创建了一个 Cauldron
  • 使用 ern cauldron 添加原生应用程序 添加原生应用程序 TestApp

但是当我使用 ern run-ios 运行应用程序时,它似乎仍然指向我的本地计算机(我可以更新 index-ios.js 文件并在应用程序中更新)。那么,让整个 OTA 设置运行到另一个程序员可以更新 cloud/bitbucket 中的 index-ios.js 文件(我猜)并即时更新应用程序的地方缺少什么?

4

2 回答 2

0

我最终让它在第二次尝试中工作 - 我正在进行的笔记如下:

我在网上搜索并在这里和那里使用了一点,所以不能真正为您指出一个简单的指南..

先决条件

安装自制软件

https://brew.sh/

安装 ReactNative-cli-tools 和 codePush

冲泡安装节点

酿造安装守望者

npm install -g react-native-cli

npm install -g code-push-cli

代码推送寄存器

代码推送寄存器

(完成注册,再次运行此命令进行验证,它应该说:[错误]您已经从这台机器登录。)

应用程序

react-native init [AppName] cd [AppName] npm install --save react-native-code-push npm install (安装code-push的时候出了点问题,所以我们要重新安装一些react-native元素)

code-push app add ReactApp ios react-native (复制生产部署密钥)

React-native 链接 react-native-code-push (输入生产部署密钥)

编辑 App.js

从 'react-native-code-push' 导入 codePush

(从主 App 类中删除“导出默认值”)

const codePushOptions = {
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.IMMEDIATE
}

导出默认codePush(codePushOptions)(App);

将应用程序发布到 codePush 服务器

code-push release-react ReactApp ios --deploymentName Production

命令查看 reactApp codePush 服务器的当前状态

代码推送部署 ls ReactApp -k

在 \ios-folder 中打开 xCode 项目

根据需要设置签名

编辑 xCode 方案以发布

编辑 App.js 以使更改可见

构建和应用程序内容应在打开后更新,以反映上传到 codePush-server 的版本与本地版本之间所做的更改

于 2018-02-13T08:55:33.030 回答
0

如果我理解正确,要使 OTA 工作,您需要使用 code-push 命令。

ern code-push <miniapps..>

Options:
  --help                     Show help                                                                                                                                                             [boolean]
  --descriptor, -d           Full native application selector (target native application version for the push)
  --force, -f                Force upgrade (ignore compatibility issues -at your own risks-)
  --appName                  Application name
  --deploymentName           Deployment to release the update to                                                                                                                                    [string]
  --platform, -p             Platform name (android / ios)                                                                                                                                          [string]
  --targetBinaryVersion, -t  Semver expression that specifies the binary app version(s) this release is targeting (e.g. 1.1.0, ~1.2.3)                                                              [string]
  --mandatory, -m            Specifies whether this release should be considered mandatory                                                                                                  [default: false]
  --rollout, -r              Percentage of users this release should be immediately available to                                                                                  [string] [default: "100%"]
  --skipConfirmation, -s     Skip final confirmation prompt if no compatibility issues are detected

More info about this command @ https://electrode.gitbooks.io/electrode-native/content/cli/code-push.html
于 2017-12-01T02:02:59.367 回答