我在編譯iOS APP。同樣的命令:
xcodebuild -target "${TARGET_NAME}" -configuration "${BUILD_TYPE}" -sdk "${SDK_TYPE}" ONLY_ACTIVE_ARCH=NO build
在機器上執行正常,在jenkins上執行,就說簽名匹配錯誤:
Check dependencies
Code Sign error: No matching codesigning identity found: No codesigning identities (i.e. certificate and private key pairs) matching “iPhone Distribution: xxxx.” were found.
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Build step 'Execute shell' marked build as failure
查來查去,發現是證書的安裝位置問題:
因爲jenkins運行在Mac的守護進程模式,只是認爲它是一個不同的用戶,所以不會有機會獲得鑰匙圈或提供個人資料作爲您登錄使用您的憑據,而我的證書是裝在“登錄”下的,這會導致代碼簽名有問題。
所以修改如下:
鑰匙鏈中,右鍵點擊在“登錄”下的證書,拷貝,粘貼到“系統”裏,就好了~