diff --git a/src/get-started/install/_ios-setup.md b/src/get-started/install/_ios-setup.md index dc8e36a96a..c3798fb8df 100644 --- a/src/get-started/install/_ios-setup.md +++ b/src/get-started/install/_ios-setup.md @@ -73,6 +73,9 @@ follow this procedure. 1. If using Xcode 15 or greater, download and install the iOS Simulator by running the following command: + 如果使用 Xcode 15 或更高的版本, + 请运行以下指令下载并安装 iOS 模拟器: + ```terminal $ xcodebuild -downloadPlatform iOS ``` @@ -81,219 +84,407 @@ follow this procedure. iOS Simulator, check out [Apple's documentation on installing Simulators][] for more options. + 如果你想使用其他方式下载和安装 iOS 模拟器,请查阅 + [Apple 文档中的安装模拟器][Apple's documentation on installing Simulators] + 了解更多方案。 + 1. To start the Simulator, run the following command: + 运行以下指令启动模拟器: + ```terminal $ open -a Simulator ``` 1. Set your Simulator to use a 64-bit device (iPhone 5s or later). + 将模拟器设置使用为 64 位设备(iPhone 5s 或更新的设备)。 + - From Xcode, choose a simulator device type. Go to **Product** > **Destination** > Choose your target device. + 通过 Xcode 选择模拟器设备类型。 + 打开 **Product** > + **Destination** > + 选择目标设备。 + - From the Simulator app, go to **File** > **Open Simulator** > Choose your target iOS device + 通过 Simulator app 选择模拟器设备。 + 打开 **File** > + **Open Simulator** > + 选择目标设备。 + - To check the device version in the Simulator, open the **Settings** app > **General** > **About**. + 在模拟器中检查设备版本。 + 打开 **Settings** app > + **General** > + **About**。 + 1. The simulated high-screen density iOS devices might overflow your screen. If that appears true on your Mac, change the presented size in the Simulator app + 模拟的高分辨率 iOS 设备可能会溢出你的屏幕。 + 如果在 Mac 上出现这种情况, + 请在 Simulator app 中更改显示大小。 + - To display the Simulator at a small size, go to **Window** > **Physical Size** or
press Cmd + 1. + 以小尺寸显示模拟器, + 设置 **Window** > + **Physical Size** 或者
快捷键 Cmd + 1。 + - To display the Simulator at a moderate size, go to **Window** > **Point Accurate** or
press Cmd + 2. + 以中尺寸显示模拟器, + 设置 **Window** > + **Point Accurate** 或者
快捷键 Cmd + 2。 + - To display the Simulator at an HD representation, go to **Window** > **Pixel Accurate** or
press Cmd + 3. _The Simulator defaults to this size._ + 以 HD 高清显示模拟器, + 设置 **Window** > + **Pixel Accurate** 或者
快捷键 Cmd + 3。 + - The Simulator defaults to **Fit Screen**. If you need to return to that size, go to **Window** > **Fit Screen** or press Cmd + 4. + 模拟器默认为 **Fit Screen(适应屏幕)**。 + 如果你需要恢复到该尺寸的设置, + 设置 **Window** > + **Fit Screen** 或者
快捷键 Cmd + 4。 + ### Deploy to physical iOS devices +### 部署到 iOS 真机 + To deploy your Flutter app to a physical iPhone or iPad, you need to do the following: +你需要执行以下操作, +将 Flutter 应用程序部署到 iPhone 或 iPad 真机上: + - Create an [Apple Developer][] account. + + 创建 [Apple Developer][] 账户。 + - Set up physical device deployment in Xcode. + + 在 Xcode 中设置真机设备部署。 + - Create a development provisioning profile to self-sign certificates. + + 创建开发配置文件 (Provisioning Profile), + 并自行签署证书 (Signing Certificate)。 + - Install the third-party CocoaPods dependency manager if your app uses Flutter plugins. + 如果你的应用程序使用 Flutter 插件, + 请安装第三方 CocoaPods 依赖管理器。 + #### Create your Apple ID and Apple Developer account +#### 创建 Apple ID 和 Apple Developer 账户 + To test deploying to a physical iOS device, you need an Apple ID. +测试部署到 iOS 真机,你需要一个 Apple ID。 + To distribute your app to the App Store, you must enroll in the Apple Developer Program. +要在 App Store 发布你的应用程序, +你必须注册 Apple Developer Program。 + If you only need to test deploying your app, complete the first step and move on to the next section. +如果你只需要测试部署应用程序, +请完成第 1 步后继续下一节。 + 1. If you don't have an [Apple ID][], create one. + 如果你没有 [Apple ID][],请创建一个。 + 1. If you haven't enrolled in the [Apple Developer][] program, enroll now. + 如果你未注册 [Apple Developer][] program,请立即注册。 + To learn more about membership types, check out [Choosing a Membership][]. + 了解有关会员类型的更多信息, + 请查阅 [选择会员资格][Choosing a Membership]。 + [Apple ID]: https://support.apple.com/en-us/HT204316 #### Attach your physical iOS device to your Mac {#attach} +#### 将 iOS 真机连接到 Mac {#attach} + Configure your physical iOS device to connect to Xcode. +配置你的 iOS 真机连接到 Xcode。 + 1. Attach your iOS device to the USB port on your Mac. + 将 iOS 设备连接到 Mac 的 USB 端口。 + 1. On first connecting your iOS device to your Mac, your iOS device displays the **Trust this computer?** dialog. + 首次将 iOS 设备连接到 Mac 时, + 你的 iOS 设备会显示 **信任这台电脑吗?** 的对话框。 + 1. Click **Trust**. + 点击 **信任**。 + ![Trust Mac][]{:.mw-100} 1. When prompted, unlock your iOS device. + 出现提示时,解锁你的 iOS 设备。 + #### Enable Developer Mode on iOS 16 or later {:.no_toc} +#### 在 iOS 16 或更高版本上启用开发者模式 +{:.no_toc} + Starting with iOS 16, Apple requires you to enable **[Developer Mode][]** to protect against malicious software. Enable Developer Mode before deploying to a device running iOS 16 or later. +从 iOS 16 开始,Apple 要求你启用 **[开发者模式][Developer Mode]**, +以防止恶意软件。 +在部署到 iOS 16 或更高版本的设备之前,请启用开发者模式。 + 1. Tap on **Settings** > **Privacy & Security** > **Developer Mode**. + 点击 **设置** > + **隐私与安全性** > + **开发者模式**。 + 1. Tap to toggle **Developer Mode** to **On**. + 将 **开发者模式** 切换为 **打开**。 + 1. Tap **Restart**. + 点击 **重新启动**。 + 1. After the iOS device restarts, unlock your iOS device. + 重新启动 iOS 设备后,解锁 iOS 设备。 + 1. When the **Turn on Developer Mode?** dialog appears, tap **Turn On**. + 当出现 **打开开发者模式吗?** 对话框时,点击 **打开**。 + The dialog explains that Developer Mode requires reducing the security of the iOS device. + 对话框会提示开发者模式会降低 iOS 设备的安全性。 + 1. Unlock your iOS device. -1. Go to **Privacy & Security** > - **Developer Mode**. - -1. Tap to toggle **Developer Mode** to on. - iOS displays a prompt to restart your device. - -1. Click **Restart**. - -1. After your device restarts and you unlock your device, - iOS asks if you want to **Turn On Developer Mode?** - Tap **Turn On**. - -1. Unlock your iOS device. + 解锁你的 iOS 设备。 #### Enable developer code signing certificates +#### 启用开发者代码签名证书 (signing certificates) + To deploy to a physical iOS device, you need to establish trust with your Mac and the iOS device. This requires you to load signed developer certificates to your iOS device. To sign an app in Xcode, you need to create a development provisioning profile. +在部署到 iOS 真机前,你需要在 Mac 与 iOS 设备之间建立信任。 +这需要将签名的开发者证书加载到 iOS 设备上。 +在 Xcode 中签署应用程序, +你需要创建一个开发者配置文件 (Provisioning Profile)。 + Follow the Xcode signing flow to provision your project. +请按照 Xcode 签名流程配置你的项目。 + 1. Open Xcode. + 打开 Xcode。 + 1. Sign in to Xcode with your Apple ID. + 使用 Apple ID 登录 Xcode。 + {: type="a"} 1. Go to **Xcode** > **Settings...* + + 选择 **Xcode** > + **Settings...* + 1. Click **Accounts**. + + 点击 **Accounts**。 + 1. Click **+**. + + 点击 **+**。 + 1. Select **Apple ID** and click **Continue**. + + 选择 **Apple ID** 并点击 **Continue**。 + 1. When prompted, enter your **Apple ID** and **Password**. + + 出现提示时,请输入你的 **Apple ID** 和 **Password**。 + 1. Close the **Settings** dialog. + 关闭 **Settings** 对话框。 + Development and testing supports any Apple ID. + 开发和测试支持任意 Apple ID。 + 1. Go to **File** > **Open...** + 打开 **File** > **Open...** + You can also press Cmd + O. + 你还可以使用快捷键 Cmd + O。 + 1. Navigate to your Flutter project directory. + 导航至 Flutter 项目目录。 + 1. Open the default Xcode workspace in your project: `ios/Runner.xcworkspace`. + 打开项目中默认的 Xcode workspace:`ios/Runner.xcworkspace`。 + 1. Select the physical iOS device you intend to deploy to in the device drop-down menu to the right of the run button. + 在运行按钮右侧的设备下拉菜单中选择你要部署的 iOS 真机。 + It should appear under the **iOS devices** heading. + 它应该出现在 **iOS devices** 标题下方。 + 1. In the left navigation panel under **Targets**, select **Runner**. + 在左侧导航面板的 **Targets** 下,选择 **Runner**。 + 1. In the **Runner** settings pane, click **Signing & Capabilities**. + 在 **Runner** 设置窗内,点击 **Signing & Capabilities**。 + 1. Select **All** at the top. + 选择顶部的 **All**。 + 1. Select **Automatically manage signing**. + 选择 **Automatically manage signing**。 + 1. Select a team from the **Team** dropdown menu. + 从 **Team** 下拉菜单中选择一个团队。 + Teams are created in the **App Store Connect** section of your [Apple Developer Account][] page. If you have not created a team, you can choose a _personal team_. + 团队是在 [Apple Developer Account][] 页面的 **App Store Connect** 创建的。 + 如果你尚未创建团队,可以选择 _个人团队 (personal team)_。 + The **Team** dropdown displays that option as **Your Name (Personal Team)**. + **Team** 下拉菜单中会显示名为 **你的名称 (Personal Team)** 的选项。 + ![Xcode account add][]{:.mw-100} After you select a team, Xcode performs the following tasks: + 选择团队后,Xcode 会执行以下工作。 + {: type="a"} 1. Creates and downloads a Development Certificate + + 创建并下载开发证书 + 1. Registers your device with your account, + + 将设备注册到你的账户 + 1. Creates and downloads a provisioning profile if needed + 根据需要创建并下载配置文件 (Provisioning Profile) + If automatic signing fails in Xcode, verify that the project's **General** > **Identity** > **Bundle Identifier** value is unique. +如果在 Xcode 中自动签名失败,请检查项目的 **General** > +**Identity** > +**Bundle Identifier** 值是否唯一。 + ![Check the app's Bundle ID][]{:.mw-100} #### Enable trust of your Mac and iOS device {#trust} +#### 启用 Mac 和 iOS 设备之间的信任 {#trust} + When you attach your physical iOS device for the first time, enable trust for both your Mac and the Development Certificate on the iOS device. +首次连接 iOS 真机时, +为你的 Mac 和 iOS 设备上的开发证书启用信任。 + ##### Agree to trust your Mac +##### 同意信任你的 Mac + You should enabled trust of your Mac on your iOS device when you [attached the device to your Mac](#attach). +将你的设备连接到 Mac 时,需要 [启用 iOS 设备对 Mac 的信任](#attach)。 + ##### Enable developer certificate for your iOS devices +##### 为 iOS 设备启用开发者证书 + Enabling certificates varies in different versions of iOS. +在不同版本的 iOS 中,启用证书的方式也不尽相同。 + {% comment %} Nav tabs {% endcomment -%}