如何在带有手表扩展的Xcode

如何在带有手表扩展的Xcode

本文介绍了如何在带有手表扩展的Xcode 7中使用xcodebuild的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的命令以前是这样的

Our command used to be like this

xcodebuild -configuration Release -target "xxx" -sdk iphoneos9.0 -scheme "xxx" archive

现在在Xcode 7中,我们收到此错误:

Now in Xcode 7, we get this error:

Build settings from command line:
    SDKROOT = iphoneos9.0

=== BUILD TARGET xxx WatchKit Extension OF PROJECT Mobile WITH CONFIGURATION Release ===

Check dependencies
target specifies product type 'com.apple.product-type.watchkit2-extension', but there's no such product type for the 'iphoneos' platform

我们如何指定使用iOS 9.0 SDK和watchos 2.0 SDK?

How do we specify to use iOS 9.0 SDK and the watchos 2.0 SDK?

推荐答案

如果您需要模拟器构建,请运行以下命令:

If you need a simulator build run this:

xcodebuild -workspace WorkspaceName.xcworkspace -scheme SchemeWithWatchOS2Target -destination 'name=iPhone 6' build

如果需要构建设备,请运行以下命令:

And if you need a device build run this:

xcodebuild -workspace WorkspaceName.xcworkspace -scheme SchemeWithWatchOS2Target build

诀窍是,对于任何构建,都需要删除-sdk选项.对于模拟器构建,您需要指定-destination,该值应为iPhone 6iPhone 6 Plus.对于设备版本,您可以跳过-destination.

The trick is that for any build you need to remove -sdk option. For simulator build you need to specify -destination which should be iPhone 6 or iPhone 6 Plus. And for devices builds you skip -destination.

这篇关于如何在带有手表扩展的Xcode 7中使用xcodebuild的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:20