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;
引自:
http://www.chengxuyuans.com/iPhone_IOS/83733.html
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.