我正在尝试在 Jenkins 上使用 xbuild 构建 Xamarin iOS 应用程序。有时在代码签名过程中构建会失败并出现未知错误 -1=ffffffffffffffff 有时构建会成功。配置文件存储在 Jenkins 通过 Keychains and Provisioning Profiles Plugin 引用的单独钥匙串(keychain) jenkins.keychain(不是系统或登录钥匙串(keychain))中。 .
这是 Jenkins 的控制台日志:
Target _CodesignAppBundle:
Codesign Task
CodesignAllocate: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
DisableTimestamp: False
Entitlements: obj/iPhone/In-House/Entitlements.xcent
Keychain: <null>
Resources:
bin/iPhone/In-House/MyApp.app
ResourceRules: <null>
SigningKey: 123
ExtraArgs: <null>
IsAppExtension: False
Tool /usr/bin/codesign execution started with arguments: -v --force --sign 123 --entitlements /private/var/lib/jenkins/workspace/Master/Apps/iOS/obj/iPhone/In-House/Entitlements.xcent /private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app
bin/iPhone/In-House/MyApp.app: error : /private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app: replacing existing signature
/private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app: unknown error -1=ffffffffffffffff
Task "Codesign" execution -- FAILED
Done building target "_CodesignAppBundle" in project "/private/var/lib/jenkins/workspace/Master/Apps/iOS/MyApp.csproj".-- FAILED
如 Codesign returned unknown error -1=ffffffffffffffff 中的建议我将 set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ${KEYCHAIN_PW} ${KEYCHAIN_PATH}
添加到我的构建脚本中,但它没有修复问题。
您知道如何解决这个问题吗?为什么要替换现有签名?
更新 1 - 我们在以下时间后不断收到错误:
- 从
xbuild
切换到msbuild
版本 15.3.0.0 - 将 jenkins 钥匙串(keychain)设置为 "Allow all applications to access this item"
- 删除 derived data folder
- 不使用
security
commands 的相对路径
Apple forum 中描述了类似的问题.
最佳答案
解决问题的方法:
在 macOS Sierra 上,钥匙串(keychain)文件扩展名从 *.keychain 更改为 *.keychain-db。代码签名错误是由于我们在编辑包含更新证书的 jenkins.keychain-db 文件时引用旧钥匙串(keychain)文件引起的。 Keychains with the new extension are rejected from the upload with Jenkins' keychain plugin .所以我们不再使用钥匙串(keychain)插件并将签名证书存储在 login.keychain-db 中。有了这个,我们就可以成功构建应用程序,而不会出现未知错误。
关于ios - Codesign 在 "replacing existing signature"后返回未知错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45440727/