You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xcode 14:连接iPhone设备无法预览Swift项目求助

iPhone 13真机预览失败补充解决方法

我是Swift和Xcode新手,在连接的iPhone 13设备上预览项目时遇到问题:模拟器预览正常,但连接设备时无法完成预览,错误提示为“Cannot preview in this file”,诊断信息如下:

RemoteHumanReadableError: The operation couldn’t be completed. Transaction failed. Process failed to launch. (process launch failed)

BSTransactionError (1):
==error-reason: process launch failed
==NSLocalizedFailureReason: Transaction failed. Process failed to launch. (process launch failed)
==transaction: <FBApplicationProcessLaunchTransaction: 0x283f607e0>
==error-description: Process failed to launch.

==================================

|  MessageSendFailure: Message send failure for <ServiceMessage 13: relaunch>

已尝试以下操作但未解决:

  • 删除DerivedData
  • 取消勾选“Automatically Refresh Canvas”
  • 重启Mac
  • 安装最新版Xcode(v14.0,版本号14A309)
  • 安装最新版iOS(v16.0)
  • 清理构建文件夹
  • 禁用单元测试后测试新项目(排除代码问题)
  • 联系苹果开发者支持团队(未收到回复)

针对该问题,还可以尝试以下遗漏的解决方法:

  • 检查设备信任设置:连接iPhone后,打开设备「设置」-「通用」-「VPN与设备管理」,找到你的开发者账号并点击「信任」,重启Xcode后重试预览。
  • 重置Xcode偏好设置:打开终端执行defaults delete com.apple.dt.Xcode,重启Xcode。注意此操作会重置Xcode所有自定义设置,可提前备份~/Library/Preferences/com.apple.dt.Xcode.plist文件。
  • 开启设备开发者模式:iOS 16及以上系统需开启该模式,打开设备「设置」-「隐私与安全性」-拉至底部找到「开发者模式」,开启后按提示重启设备。
  • 重新配对设备:在Xcode中点击「Window」-「Devices and Simulators」,选中iPhone 13后右键选择「Unpair Device」,重新连接设备完成配对。
  • 检查Mac防火墙设置:打开「系统设置」-「网络」-「防火墙」,确保Xcode被允许接收传入连接;若防火墙开启,点击「选项」找到Xcode并勾选允许。
  • 更换USB连接线/端口:使用MFi认证的USB-C转Lightning线,或更换Mac上的其他USB端口,排除连接硬件问题。
  • 重置设备网络设置:在iPhone上打开「设置」-「通用」-「传输或还原iPhone」-「还原」-选择「还原网络设置」,清除网络配置后重试预览(此操作会删除Wi-Fi密码等信息)。

内容的提问来源于stack exchange,提问作者gclarke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 03:50:24