背景

iOS17beta也发布了很长时间了,为了工程的稳定性,需求提前测验工程在高版别系统的是否会出现问题。其中一项便是需求在低版别Xcode中去本地跑高版别iOS设备,来定位高版别出现的问题。

问题

以往低版别Xcode要跑高版别iOS设备,只需求将/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport中对应的iOS版别添加进该目录就行,可是可是更新了xcode15之后发现,最新Xcode的DeviceSupport目录下并没有对应的ios17镜像文件。

Xcode15 beta的DeviceSupport目录:

怎么样让Xcode14.3跑iOS17 beta的设备

官方的解说是:

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.

也便是xcode15之后将会以CoreDevice的方法去对iOS设备进行兼容。 一切的Xcode设备共享一份CoreDevice和DDIs,这样在xcode15和之后版别中,只需装了最新版Xcode,一切版别的Xcode都能调试CoreDevice中兼容的iOS设备,也便是低版别Xcode也能直接兼容高版别ios设备,而无需去更改xcode中的目录。

解决问题

经测验,xcode14其实也兼容了CoreDevice的计划,仅仅默认是关闭的。

  1. 安装最新版macOS beta
  2. 下载xcode15 beta并安装(为了获取最新的CoreDevice)
  3. 执行命令(这一步的作用大概便是敞开xcode14 的CoreDevice支撑,使得xcode14能运用最新的CoreDevice。)
    defaults write com.apple.dt.Xcode DVTEnableCoreDevice enabled
    

跑起来

操作系统是最新版beta,那xcode14就不能再用了 运用方法,应用程序->xcode14->显示包内容->contents->MacOS->Xcode 进程运转起来,挑选需求执行的工程就OK了。 挑选ios7的设备时,会有个CoreDevice的标识:

怎么样让Xcode14.3跑iOS17 beta的设备
这样就能跑起来啦~

参考文档: developer.apple.com/forums/thre… stackoverflow.com/questions/7…