jenkins 腳本打包報
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
這個libswiftAVFoundation.dylib
也不報錯碾盟。 google 好久也沒找到原因沽翔,最后想了想既然是 codesign 報錯,那么直接把證書刪除浇坐,重新導(dǎo)入一遍摇予,再打包居然就** ARCHIVE SUCCEEDED **
了。
但是后面還是有一個錯** 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}
這個 google 后吗跋,參考 :https://stackoverflow.com/questions/32841300/xcodebuild-exportarchive-exportoptionsplist-error-for-key-method-expected-o ,上面的最高票答案說的也是不明所以,但是下面有一個答案是這樣寫的
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
還有好幾年才過期,但是實在沒辦法了就試試看跌宛,居然成功了酗宋。
天真的以為就這樣就好了。但是呢剛過了一天疆拘,又打包失敗了蜕猫,還是同一個錯誤。這次 經(jīng)過仔細(xì)思考哎迄,開始懷疑 是否打包的時候回右,是否是 詢問 鑰匙串密碼導(dǎo)致的,因為 加了 swift 之后漱挚,代碼編譯時間變長翔烁,雖然 編譯之前有 解鎖 鑰匙串的腳本,會不會是時間太長又鎖住了呢旨涝?
于是 趕緊 google 蹬屹,添加了 設(shè)置過期時間的腳本,鏈接https://stackoverflow.com/questions/41680511/jenkins-where-is-the-login-keychain-file-in-users-name-library-keychains-fol
# 設(shè)置過期時間
security set-keychain-settings -t 3600 -l ${HOME}/Library/Keychains/login.keychain
經(jīng)過幾分鐘的等待,打包終于又好了白华。哎慨默,希望這次能堅持的久一點 不再報錯了。
真心無力吐槽 蘋果的報錯原因弧腥,經(jīng)常報錯不說厦取,原因還不知所以。
最后附上 命令行 導(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