xcodbuild archive导出ipa出错

本文解决了一个使用Xcode时遇到的常见错误,即尝试为iOS模拟器平台归档时出现问题。通过修改命令行参数,可以解决此问题并顺利进行归档操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

xcodebuild -workspace ${NAME}.xcworkspace -scheme ${SCHEME} archive -archivePath ${PROJECT}.xcarchive;

错误信息:

[MT] DVTAssertions: Warning in /SourceCache/IDEFrameworks/IDEFrameworks-6604/IDEFoundation/Execution/Schemes/IDEScheme.m:1402
Details:  Scheme <IDEScheme:0x7fca145eae10:'schemename'> was asked to build and archive, but the run destination <IDERunDestination:0x7fca11565090:'iPhone 4s'> is not a deployment platform and this action shouldn't have been allowed.
Object:   <IDEScheme: 0x7fca145eae10>
Method:   -archiveOperationWithExecutionContext:onlyBuild:destination:overridingProperties:schemeCommand:buildLog:overridingBuildConfiguration:invocationRecord:name:title:error:actionCallbackBlock:
Thread:   <NSThread: 0x7fca11414000>{name = (null), num = 1}
Please file a bug at  http://bugreport.apple.com with this warning message and any useful information you can provide.
xcodebuild: error: Failed to build workspace wsname with scheme schemename.
Reason: You cannot archive for the iOS Simulator platform.
 
解决方法:
xcodebuild -workspace ${NAME}.xcworkspace -scheme ${SCHEME} -destination generic/platform=iOS archive -archivePath ${PROJECT}.xcarchive;
 
引自:
 
 Destinations
     The -destination option takes as its argument a destination specifier describing the device (or
     devices) to use as a destination.  A destination specifier is a single argument consisting of a set of
     comma-separated key=value pairs.  The -destination option may be specified multiple times to cause
     xcodebuild to perform the specified action on multiple destinations.

     Destination specifiers may include the platform key to specify one of the supported destination plat-forms. platforms.
     forms.  There are additional keys which should be supplied depending on the platform of the device you
     are selecting.

     Some devices may take time to look up. The -destination-timeout option can be used to specify the
     amount of time to wait before a device is considered unavailable.  If unspecified, the default timeout
     is 30 seconds.

     Currently, xcodebuild supports these platforms:

     OS X           The local Mac, referred to in the Xcode interface as My Mac, and which supports the fol-lowing following
                    lowing keys:

                    arch  The architecture to use, either x86_64 (the default) or i386.

     iOS            An iOS device, which supports the following keys:

                    name  The name of the device to use.

                    id    The identifier of the device to use, as shown in the Devices tab of the Xcode
                          Organizer.

     iOS Simulator  The iOS Simulator, which supports the following keys:

                    name  The full name of device to simulate, as presented in Xcode's UI.

                    OS    The version of iOS to simulate, such as 6._, or the string latest (the default) to
                          indicate the most recent version of iOS supported by this version of Xcode.

     Some actions (such as building) may be performed without an actual device present.  To build against a
     platform generically instead of a specific device, the destination specifier may be prefixed with the
     optional string "generic/", indicating that the platform should be targeted generically.  An example of
     a generic destination is the "iOS Device" destination displayed in Xcode's UI when no physical iOS
     device is present.

转载于:https://www.cnblogs.com/ppsunlight/p/4108751.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值