低版本Xcode运行iOS17

2,921 阅读2分钟

低版本Xcode运行iOS17设备

Xcode15要成功运行项目需要:

  1. 更改pod文件;
  2. 需要添加-ld64库;

但没升级的Xcode在又因找不到这个库运行报错。 这就导致一起开发的组内人必须事同一个Xcode版本,多人开发时,这个要求并不那么能统一。

那如何让低版本运行新iOS系统呢?

在之前,是通过向Xcode里导入对应iOS系统的device support,来实现:

前往--前往文件件--输入 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport, 里面就能看到支持的所有iOS系统固件。

但是截至目前,没有适用于iOS 17固件了。

Apple论坛里有回复线索: developer.apple.com/forums/thre…

With iOS 17+, we are using a new device stack (CoreDevice) to communicate with devices. With this new device stack, there is one DDI per platform (as opposed to per OS release). This same device stack will be shared across all versions of Xcode on your system, and installing a newer version of Xcode will update CoreDevice and its DDIs (just like how CoreSimulator is updated, if you are familiar with that).

This effectively means that you now have a supported way of updating the device stack on your system to support newer target OS devices. With CoreDevice, you should be able to debug devices running future versions of iOS using Xcode 15. This may require first installing a newer Xcode in order to install newer CoreDevice and DDIs, so keep that in mind.

Of course, this also means there is a temporary hiccup in which the old unsupported path doesn't work, but the good news is that future-you will have a supported way of doing this which works out-of-the-box, no need to modify your Xcode.app.

翻译过来:

在iOS 17+中,我们使用了一个新的设备栈(CoreDevice)来与设备通信。有了这个新的设备堆栈,每个平台都有一个DDI(而不是每个操作系统版本)。相同的设备堆栈将在你系统上的所有Xcode版本之间共享,并且安装新版本的Xcode将更新CoreDevice及其ddi(就像CoreSimulator更新一样,如果你熟悉的话)。 
 
这实际上意味着您现在有了一种受支持的方式来更新系统上的设备堆栈,以支持较新的目标操作系统设备。使用CoreDevice,你应该能够使用Xcode 15调试运行未来iOS版本的设备。这可能需要先安装一个较新的Xcode,以便安装较新的CoreDevice和ddi,所以请记住这一点。 
 
当然,这也意味着有一个暂时的问题,旧的不支持的路径不能工作,但好消息是,未来你将有一个支持的方式来做这件事,它可以开箱即用,不需要修改你的Xcode.app

简而言之: CoreDevice 是 Xcode 从 Xcode 15 开始与设备通信的新方式,之前的supportdevce方式不能用了。

所以我们现在要实行低版本xcode14运行iOS17,需要开启此功能。

终端运行: defaults write com.apple.dt.Xcode DVTEnableCoreDevice enabled

注:

此功能从Xcode14.3开始支持; 亲试Xcode14.3.1成功运行iOS17Xcode14.2没效果。