使用适用于Mac Catalyst Apple Silicon的xcodebuild构建

问题描述

我正在尝试使用Xcode 12 beta 4构建支持Mac Catalyst的Apple Silicon的框架。该项目在Xcode中以“ Any Mac”为目标可以很好地构建。 如果我使用命令

xcodebuild -project "project.xcodeproj" -configuration "Release" -scheme "MyScheme" -destination "generic/platform=macOS,variant=Mac Catalyst,name=Any Mac"

我得到了错误

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
        { generic:1,platform:macOS,variant:Mac Catalyst,name:Any Mac }
    Unsupported device specifier option.
    The device “My Mac” does not support the following options: name
    Please supply only supported device specifier options.
...
Ineligible destinations for the "MyScheme" scheme:
        { platform:iOS,id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder,name:Any iOS Device }
        { platform:iOS Simulator,id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder,name:Any iOS Simulator Device }
        { platform:macOS,name:Any Mac }

我不确定为什么在Xcode中正确构建目标时,为什么该目的地被列为不合格,或者在启用通用时,为什么xcodebuild似乎使用“ My Mac”设备。 如何使用xcodebuild在Apple Silicon上为Mac Catalyst进行构建?

解决方法

xcodebuild -project "project.xcodeproj" -configuration "Release" -scheme "MyScheme" -destination "generic/platform=macOS,variant=Mac Catalyst,name=Any Mac"

此命令现在可以在Xcode 12 beta 5中使用。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...