无法通过jenkins shell脚本使用xcodebuild命令创建IPA

时间:2018-06-19 22:30:26

标签: ios xcode shell jenkins

我正在尝试在Jenkin上使用以下命令创建IPA文件

xcodebuild -exportArchive -archivePath export/MySampleApp.xcarchive -exportPath export/ -exportOptionsPlist export/export_options.plist

但这给了我错误

    + xcodebuild -exportArchive -archivePath export/MySampleApp.xcarchive -exportPath export/ -exportOptionsPlist export/export_options.plist
2018-06-19 19:16:07.324 xcodebuild[81214:2060182] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/y5/1qdx7j6j2tdb1j6g3vvg_xww0000gn/T/MySampleApp_2018-06-19_19-16-07.323.xcdistributionlogs'.
2018-06-19 19:17:20.872 xcodebuild[81214:2060182] [MT] IDEDistribution: Step failed: <IDEDistributionPackagingStep: 0x7ff2b080be50>: Error Domain=IDEDistributionPipelineErrorDomain Code=0 "Code signing "libswiftCore.dylib" failed." UserInfo={NSLocalizedDescription=Code signing "libswiftCore.dylib" failed., NSLocalizedRecoverySuggestion=View distribution logs for more information.}
error: exportArchive: Code signing "libswiftCore.dylib" failed.

Error Domain=IDEDistributionPipelineErrorDomain Code=0 "Code signing "libswiftCore.dylib" failed." UserInfo={NSLocalizedDescription=Code signing "libswiftCore.dylib" failed., NSLocalizedRecoverySuggestion=View distribution logs for more information.}

    ** EXPORT FAILED **

我能够使用以下命令创建存档文件

xcodebuild -scheme "MySampleApp" -sdk iphoneos -target MySampleApp -destination "generic/platform=iOS" -archivePath export/MySampleApp.xcarchive archive DEVELOPMENT_TEAM="QPG8EMUULT" PROVISIONING_PROFILE="efb8da47-3b87-4880-82e8-4967167bb2d3" CODE_SIGNING_REQUIRED=NO

有人可以让我知道可能是什么问题吗?

2 个答案:

答案 0 :(得分:0)

钥匙串被锁定在Jenkin服务器上,这就是为什么它无法编码符号的原因。

xcodebuild命令之前使用以下命令将其解锁

security unlock-keychain -p yourPassword

现在工作正常。

答案 1 :(得分:0)

我遇到问题的时候:

  • xcodebuild archive使用Xcode 10
  • xcode-select到Xcode 9
  • 尝试运行xcodebuild -exportArchive

所以我xcode-select使用Xcode 10并解决了问题