ios xcodebuild -exportArchive:key 'method' 的 exportOptionsPlist 错误:预期为 {} 之一

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32841300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 07:51:50  来源:igfitidea点击:

xcodebuild -exportArchive: exportOptionsPlist error for key 'method': expected one of {}

iosxcodeios9xcode7xcodebuild

提问by Vladimir Grigorov

I'm using command line xcodebuild tool to export ad-hoc distribution ipa file out of my archive like this:

我正在使用命令行 xcodebuild 工具将临时分发 ipa 文件从我的存档中导出,如下所示:

xcodebuild -exportArchive -archivePath /path/Archive.xcarchive -exportPath /path -exportOptionsPlist /path/options.plist

However, this command fails with error

但是,此命令失败并显示错误

exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found ad-hoc

No mater what 'method' I provide in my export options plist, it always fails with this error. It also fails if I remove the 'method' option from the plist file.

无论我在导出选项 plist 中提供什么“方法”,它总是因此错误而失败。如果我从 plist 文件中删除“方法”选项,它也会失败。

回答by Vladimir Grigorov

I suspected xcodebuild tool initially, but it turned out the archive file was invaid. When I opened the archive file in Xcode and tried to export an ipa file manually, I noticed that "Upload to App Store" and "Validate" buttons were disabled. After clicking the "Export" button, it gave me two options: "Save Built Products" and "Export as an Xcode Archive", but there was no Export ad-hoc distribution and the other regular options.

我最初怀疑 xcodebuild 工具,但结果发现存档文件无效。当我在 Xcode 中打开存档文件并尝试手动导出 ipa 文件时,我注意到“上传到 App Store”和“验证”按钮被禁用。单击“导出”按钮后,它给了我两个选项:“保存构建的产品”和“导出为 Xcode 存档”,但没有导出临时分发和其他常规选项。

It turned out there were few library files along my .app file in the archive. Xcode considers this a generic archive and not an app archive. Check the Build Phases in your project settings for copying header and library files.

结果发现存档中我的 .app 文件中几乎没有库文件。Xcode 认为这是一个通用存档而不是应用程序存档。检查项目设置中的构建阶段以复制头文件和库文件。

For more details, see https://developer.apple. com/library/ios/technotes/tn2215/_index.html

有关更多详细信息,请参阅https://developer.apple。com/library/ios/technotes/tn2215/_index.html

回答by Zmicier Zaleznicenka

I had this issue in one of my projects. After updating Cocoapods from 0.38.2 to 0.39.0 it was gone.

我在我的一个项目中遇到了这个问题。将 Cocoapods 从 0.38.2 更新到 0.39.0 后,它消失了。

Also, I had a different related issue. Exporting was failing with the following error:

另外,我有一个不同的相关问题。导出失败,出现以下错误:

2015-10-22 17:16:12.568 xcodebuild[91172:2171408] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/_l/2rl169m16p717gzldvh7n0600000gq/T/MyDriveEU_2015-10-22_17-16-12.568.xcdistributionlogs'.
2015-10-22 17:16:12.860 xcodebuild[91172:2171408] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fbc13f0c970>: Error Domain=IDEDistributionErrorDomain Code=1 "The operation couldn't be completed. (IDEDistributionErrorDomain error 1.)"
error: exportArchive: The operation couldn't be completed. (IDEDistributionErrorDomain error 1.)

Error Domain=IDEDistributionErrorDomain Code=1 "The operation couldn't be completed. (IDEDistributionErrorDomain error 1.)"

** EXPORT FAILED **

It turned out that xcodebuild didn't like teamIDparameter I added to the exportOptions.plist. After I removed it, the app was exported successfully.

事实证明 xcodebuild 不喜欢teamID我添加到exportOptions.plist. 删除后,该应用程序已成功导出。

回答by Pavel P

In my case one of my static libs did not have Skip Installenabled and this resulted in the same problem. When I set in xcode Skip Installto Yesfor that project I fixed that problem.

在我的情况下,我的一个静态库没有Skip Install启用,这导致了同样的问题。当我在 xcodeSkip InstallYes为那个项目设置时,我解决了这个问题。

回答by Razordrant

I had the same issue since two days, The issue came from Apple certificates. Delete Apple Worldwide Developer Relations certification Authority from your keychain (would be expired at 14 Feb) and so renew it by download :

两天以来我遇到了同样的问题,问题来自 Apple 证书。从您的钥匙串中删除 Apple Worldwide Developer Relations 认证机构(将于 2 月 14 日到期),然后通过下载更新:

https://developer.apple.com/news/?id=02092016a

https://developer.apple.com/news/?id=02092016a

回答by Oliver Pearmain

I had the same issue and discovered when looking in KeyChain that the certificate used for signing had been revoked. Archiving worked fine but when we came to -exportArchive we got this cryptic error. HTH.

我遇到了同样的问题,并在查看 KeyChain 时发现用于签名的证书已被吊销。存档工作正常,但是当我们使用 -exportArchive 时,我们遇到了这个神秘的错误。哈。

回答by mamills

Pavel P's solution was

Pavel P 的解决方案是

In my case one of my static libs did not have Skip Install enabled and this resulted in the same problem. When I set in xcode Skip Install to Yes for that project I fixed that problem.

在我的情况下,我的一个静态库没有启用跳过安装,这导致了同样的问题。当我将该项目的 xcode Skip Install 设置为 Yes 时,我解决了该问题。

Along the same vein, I was calling "xcodebuild" and passing in SKIP_INSTALL=NO as an option.

同样,我正在调用“xcodebuild”并传入 SKIP_INSTALL=NO 作为选项。

e.g.,

例如,

xcodebuild clean analyze archive -workspace MyWorkspace.xcworkspace -scheme MyScheme -configuration Debug SKIP_INSTALL=NO -archivePath /MyPath/MyArchive.xcarchive

Removing SKIP_INSTALL=NO in this case fixed my particular situation.

在这种情况下删除 SKIP_INSTALL=NO 修复了我的特殊情况。

回答by Bigyelow

https://developer.apple.com/library/content/technotes/tn2215/_index.html#//apple_ref/doc/uid/DTS40011221-CH1-PROJ

https://developer.apple.com/library/content/technotes/tn2215/_index.html#//apple_ref/doc/uid/DTS40011221-CH1-PROJ

Check the following reasons:

检查以下原因:

  • Your archive contains header files.
  • Your archive contains static libraries or frameworks.
  • 您的存档包含头文件。
  • 您的存档包含静态库或框架。

回答by Keesara Sriramreddy

This forum helped me to fix the issue.
https://forums.developer.apple.com/message/59201#59201

这个论坛帮助我解决了这个问题。
https://forums.developer.apple.com/message/59201#59201

SOLUTION:change the key from 'method' to 'export_method' in the exportOptionsPlist.

解决方案:将 exportOptionsPlist 中的密钥从“method”更改为“export_method”。