xcodebuild /usr/bin/codesign unknown error -1=ffffffffffffffff

jenkins 腳本打包報(bào)

unknown error -1=ffffffffffffffff

  /usr/bin/codesign '--force' '--sign' '***********' '--verbose' '/Users/Shared/Jenkins/Home/workspace/***/build/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/***/InstallationBuildProductsLocation/Applications/***.app/Frameworks/libswiftAVFoundation.dylib'
/Users/Shared/Jenkins/Home/workspace/***/build/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/***/InstallationBuildProductsLocation/Applications/***.app/Frameworks/libswiftAVFoundation.dylib: unknown error -1=ffffffffffffffff
error: Task failed with exit 1 signal 0 {
    /usr/bin/codesign '--force' '--sign' '****************' '--verbose' '/Users/Shared/Jenkins/Home/workspace/***/build/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/***/InstallationBuildProductsLocation/Applications/***.app/Frameworks/libswiftAVFoundation.dylib'

看了使用的證書和配置文件都是對的,clean xcode,重啟電腦 都不起作用。如果用 xcode 直接打包也是好的,直接 codesign 這個(gè)libswiftAVFoundation.dylib 也不報(bào)錯(cuò)。 google 好久也沒找到原因,最后想了想既然是 codesign 報(bào)錯(cuò),那么直接把證書刪除,重新導(dǎo)入一遍,再打包居然就** ARCHIVE SUCCEEDED **了。

但是后面還是有一個(gè)錯(cuò)** EXPORT FAILED **

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

Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'method': expected one of {}, but found enterprise" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'method': expected one of {}, but found enterprise}

這個(gè) google 后,參考 :https://stackoverflow.com/questions/32841300/xcodebuild-exportarchive-exportoptionsplist-error-for-key-method-expected-o ,上面的最高票答案說的也是不明所以,但是下面有一個(gè)答案是這樣寫的

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 :

[https://developer.apple.com/news/?id=02092016a](https://developer.apple.com/news/?id=02092016a)

雖然我的 Apple Worldwide Developer Relations certification 還有好幾年才過期,但是實(shí)在沒辦法了就試試看,居然成功了。

天真的以為就這樣就好了。但是呢剛過了一天,又打包失敗了,還是同一個(gè)錯(cuò)誤。這次 經(jīng)過仔細(xì)思考,開始懷疑 是否打包的時(shí)候,是否是 詢問 鑰匙串密碼導(dǎo)致的,因?yàn)?加了 swift 之后,代碼編譯時(shí)間變長,雖然 編譯之前有 解鎖 鑰匙串的腳本,會不會是時(shí)間太長又鎖住了呢?

于是 趕緊 google ,添加了 設(shè)置過期時(shí)間的腳本,鏈接https://stackoverflow.com/questions/41680511/jenkins-where-is-the-login-keychain-file-in-users-name-library-keychains-fol

# 設(shè)置過期時(shí)間
security set-keychain-settings -t 3600 -l ${HOME}/Library/Keychains/login.keychain

經(jīng)過幾分鐘的等待,打包終于又好了。哎,希望這次能堅(jiān)持的久一點(diǎn) 不再報(bào)錯(cuò)了。

真心無力吐槽 蘋果的報(bào)錯(cuò)原因,經(jīng)常報(bào)錯(cuò)不說,原因還不知所以。

最后附上 命令行 導(dǎo)入 鑰匙串的命令

# 解鎖鑰匙串
security unlock-keychain -p  *password* login.keychain-db

# 刪除
security delete-certificate -Z 證書identifier

# 導(dǎo)入p12
security import *.p12 -k login.keychain-db -P *password* -T /usr/bin/codesign

# 查看導(dǎo)入的證書
security find-identity -p codesigning login.keychain-db

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容