连接 iOS 设备

Qt Creator 和 iOS 设备之间的连接受证书保护,该证书是您注册苹果开发者计划时从苹果公司获得的。在配置设备时,证书会被复制到设备上。

首次将设备连接到本地计算机时,系统会要求你在设备上启用开发者模式。下次连接设备时,Qt Creator 会自动检测到设备。要禁用与不用于开发的设备的自动连接,请进入首选项 >iOS 并清除Ask about devices not in developer mode

注意: 配置设备和用户界面的过程因您使用的 Xcode 版本而略有不同。我们建议您使用最新可用的 Xcode 版本。

创建与 iOS 设备的连接

配置Qt Creator 与 iOS 设备之间的连接:

  1. 检查您是否安装了 Xcode 和Qt for iOS
  2. 用 USB 电缆将设备连接到本地计算机。
  3. 启动 Xcode 配置设备。

    例如,在 Xcode 版本 15 中,转到Window >Devices and Simulators >Devices ,然后选择+ 添加连接的设备。

  4. 指定构建设置:
    1. 为要为设备开发的应用程序打开一个项目。
    2. 转到Projects >Build & Run ,选择用于构建应用程序并在 iOS 上运行的工具包。

      在 "构建和运行 "中为项目选择 iOS 工具包

    3. iOS Settings 中,选择用于签署和供应应用程序的开发团队。您必须使用 Apple 开发者帐户在 Xcode 中配置开发团队和供应配置文件。

      iOS 构建设置

    4. 选择Automatically manage signing ,在本地计算机上自动选择与 iOS 设备的权限和捆绑标识符相匹配的调配配置文件和签名证书。
  5. 选择Run 以指定运行设置。

    通常可以使用默认设置。

    运行项目时,Qt Creator 会使用 Xcode 将应用程序部署到设备。

    您的签名证书用于签署应用程序软件包,以便部署到设备。

注意: 如果因为缺少供应配置文件而无法部署应用程序,请访问Xcode >Preferences >Accounts ,检查 Xcode 中是否列出了供应配置文件。有关如何获取和安装供应配置文件的更多信息,请参阅 Apple 文档。

查看设备连接状态

通过 USB 将 iOS 设备连接到本地计算机时,如果您使用 Xcode 进行了配置,Qt Creator 会自动检测设备。要查看已连接设备的信息,请访问Preferences >Devices

设备偏好设置中的设备选项卡

如果当前设备状态为Connected ,(交通灯图标为橙色),则需要使用 Xcode 配置设备。

另请参阅 "为项目激活工具包"、"如何:为 iOS 开发"和 "为 iOS 开发"

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.