开发版本中的预览更新
了解如何使用 expo-dev-client 库在开发版本中预览已发布的 EAS 更新。
[expo-dev-client](/develop/development-builds/introduction/) 库允许通过创建开发版本来启动不同版本的项目。任何兼容的 EAS 更新都可以在开发版本中预览。
本指南介绍了如何在开发版本中使用 扩展 选项卡或构建特定更新 URL 来加载和预览已发布更新的步骤。
🌐 This guide walks through the steps required to load and preview a published update inside a development build using the Extensions tab or constructing a specific Update URL.
先决条件
🌐 Prerequisites
- 创建一个开发版并安装 到你的设备或 Android 模拟器或 iOS 模拟器上。
- 确保你的开发构建已安装
expo-updates库。
什么是扩展选项卡
🌐 What is an Extensions tab
在开发版本中使用 expo-updates 库时,扩展 标签可以自动加载并预览已发布的更新。
🌐 When using the expo-updates library inside a development build, the Extensions tab provides the ability to load and preview a published update automatically.
使用扩展选项卡预览更新
🌐 Preview an update using the Extensions tab
1
在你的项目中本地进行非本地更改,然后使用 eas update 发布它们。更新将发布在一个分支上。
🌐 Make non-native changes locally in your project and then publish them using eas update. The update will be published on a branch.
2
发布更新后,打开你的开发版本,进入 扩展,然后点击 登录 在开发版本中登录你的 Expo 账户。此步骤是必须的,以便 扩展 标签可以加载与你的 Expo 账户下项目相关的任何已发布更新。
🌐 After publishing the update, open your development build, go to Extensions, and tap Login to log in to your Expo account within the development build. This step is required for the Extensions tab to load any published updates associated with the project under your Expo account.
3
登录后,在 扩展 标签中会出现一个 EAS 更新部分,其中包含一个或多个最新发布的更新。点击你想要预览的更新旁的 打开。
🌐 After logging in, an EAS Update section will appear inside the Extensions tab with one or more of the latest published updates. Tap Open next to the update you want to preview.
在 扩展 选项卡中,你可以查看某个分支的所有已发布更新列表。点击 扩展 选项卡中的分支名称。
🌐 In the Extensions tab, you can view the list of all published updates for a branch. Tap the branch name in the Extensions tab.
使用 EAS 仪表板预览更新
🌐 Preview an update using the EAS dashboard
你也可以通过以下步骤在 EAS 控制面板上预览更新:
🌐 You can also preview an update using the EAS dashboard by following the steps below:
- 在运行发布更新的命令后,点击 CLI 中已发布的更新链接。这将打开 EAS 仪表板中 更新 页面上的更新详情。
- 点击 预览。这将打开 预览 对话框。
- 要预览更新,你可以使用设备的摄像头扫描二维码,或选择一个平台来通过 Open with Orbit 启动更新。
构建更新网址
🌐 Construct an update URL
作为前面各节中描述的方法的替代方案,你可以构建一个特定的 URL 在开发版本中打开你的 EAS 更新。该 URL 将如下所示:
🌐 As an alternative to the methods described in the previous sections, you can construct a specific URL to open your EAS Update in the development build. The URL will look like the following:
[slug]://expo-development-client/?url=[https://u.expo.dev/project-id]/group/[group-id]# Examplemy-app://expo-development-client/?url=https://u.expo.dev/675cb1f0-fa3c-11e8-ac99-6374d9643cb2/group/47839bf2-9e01-467b-9378-4a978604ab11让我们分解此 URL 以了解每个部分的作用:
🌐 Let's break this URL to understand what each part does:
| Part of URL | Description |
|---|---|
slug | The project's slug found in the app config. |
://expo-development-client/ | Necessary for the deep link to work with the expo-dev-client library. |
?url= | Defines a url query parameter. |
https://u.expo.dev/675cb1f0-fa3c-11e8-ac99-6374d9643cb2 | This is the updates URL, which is inside the project's app config under updates.url. |
/group/47839bf2-9e01-467b-9378-4a978604ab11 | The group ID of the update. |
一旦构建了 URL,请直接将其复制并粘贴到开发版本启动器屏幕的 手动输入 URL 下。
🌐 Once you've constructed the URL, copy and paste it directly into the development build's launcher screen under Enter URL Manually.
或者,你可以为该网址创建二维码,并使用设备的相机扫描。当扫描后,该网址将打开指定渠道的开发版本。
🌐 Alternatively, you can create a QR code for the URL and scan it using your device's camera. When scanned, the URL will open up the development build to the specified channel.
示例
🌐 Example
查看一个使用 expo-dev-client 和EAS更新的工作示例。