真机运行提示:
Failed to prepare the device for development. This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your Mac and device in order to correctly detect compatibility.
原因是手机系统升级了, xcode还没升级,xcode里不包含最新的真机调试包导致; 这里是所有的真机调试包: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
解决办法1 最简单的解决办法: 找一台系统版本低于xcode版本的手机; 例如:手系统版本是 16.4, 并且xcode的真机调试包里有16.4 这个调试包就可以.
解决办法2 网上找到 手机系统版本对应的调试包 放在上面的文件路径里重启xcode.
解决办法3
复制一份旧的SDK,并重新命名为真机测试需要的SDK版本 打开 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
把刚才复制的打开,把里面所有跟版本相关的改成当前版本
打开 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
以上2个步骤就添加了真机调试包,重启xcode.
真机调试问题会有很多种,找到对应的解决办法,本文仅供参考.