programing

Xcode 명령 / usr / bin / codesign이 종료 코드 1과 함께 실패했습니다. errSecInternalComponent

nasanasas 2020. 10. 15. 07:53
반응형

Xcode 명령 / usr / bin / codesign이 종료 코드 1과 함께 실패했습니다. errSecInternalComponent


장치에서 앱을 테스트하기 위해 Xcode에 새 프로비저닝 프로파일을 추가하려고합니다. 내가 따랐던 단계는 다음과 같습니다.

  1. 모든 인증서 및 프로비저닝 프로파일을 삭제했습니다.

  2. IOS 개발 인증서 생성 / 추가

  3. 온라인으로 내 IOS 장치 추가

  4. IOS 프로비저닝 프로파일 생성

  5. IOS 프로비저닝 프로필 추가

  6. 깨끗한 앱

  7. 앱 빌드 후 실행

  8. 빌드 설정에서 공동 설계 및 프로비저닝 프로파일 설정

  9. 많은 인터넷 검색> 성공하지 못함

내가 얻는 오류는 다음과 같습니다.

CSSM_SignData returned: 800108E6
/Users/alexpelletier/Library/Developer/Xcode/DerivedData/MyExpense-efnqzvoqwngzcmazaotyalepiice/Build/Products/Debug-iphoneos/MyExpense.app:     errSecInternalComponent
Command /usr/bin/codesign failed with exit code 1

열기 키 체인 접근은 다음에 파일 메뉴를 선택 잠금 모든 열쇠 고리를 .

그런 다음 Xcode로 돌아가서 정리하고 다시 빌드하십시오. 키 체인을 잠금 해제하기 위해 암호를 다시 입력하라는 메시지가 표시됩니다.

그 후에 다른 컴파일 문제가 없다고 가정하면 성공할 것입니다!


코드 서명 메커니즘의 버그 인 것 같습니다. Mac을 다시 시작하면 문제가 해결됩니다.


로그인 키 체인이 잠겨있을 때 발생합니다. 로그인 키 체인을 잠금 해제하려면 다음을 실행하십시오.

security unlock-keychain login.keychain

그런 다음 빌드 또는 코드 서명 작업을 다시 시도하십시오. 문제의 오류 코드는 Apple 문서 에 내부 오류로 설명되어 있으므로 다른 경우에도 발생할 수 있습니다.


High Sierra/ 에서 동일한 문제가 발생하여 Xcode 9.4.1모든 로그인 시도가 종료되었습니다.errSecInternalComponent

    • 키 체인 접근으로 이동
    • 로그인 키 체인으로 이동
    • "내 인증서"카테고리를 선택하십시오.
    • 서명 할 인증서를 찾아 확장하여 키를 확인합니다.
    • 키를 두 번 클릭하십시오.
    • "액세스 제어"탭으로 이동합니다.
    • 키 액세스 제어를 "모든 애플리케이션이이 항목에 액세스하도록 허용"으로 업데이트하십시오.

또는 :

mac 터미널에서 codesign 명령을 실행하고 키에 대한 / usr / bin / codesign 액세스를 "항상 허용"합니다.

  1. ssh / CI에서 서명하려면 다음을 실행해야합니다.

    security unlock-keychain login.keychain
    

    App Bundle에 서명하기 전에


같은 문제가 발생하여 macOS를 다시 시작하면 작동합니다.

중국에서는 개발자들 사이에 다음과 같은 말이 있습니다.

약간의 문제는 다시 시작하십시오. 큰 문제는 다시 설치해야합니다.

때로는 위의 말이 큰 도움이 될 것입니다!


다른 사람에게 도움 이되는 경우 macOS 컴퓨터에 대한 ssh 세션을 통해 실행했기 때문에 errSecInternalComponent오류 가 발생했습니다 codesign. macOS 컴퓨터 자체의 터미널 창에서 동일한 명령을 실행하면 작동했습니다.

아마도 이것은 codesign로그인 키 체인에서 개인 키에 액세스해야 하기 때문일 것입니다.

동일한 세션에서 실행 security unlock-keychain login.keychain( cbracken의 답변에 설명 됨 )도 작동합니다.


ssh 실행 명령에서 서명하려는 경우 :

security unlock-keychain login.keychain

App Bundle에 서명하기 전에

또는 UI에서

키 액세스 제어를 "모든 애플리케이션이이 항목에 액세스하도록 허용"으로 업데이트하십시오.

Thx에서 @Equilibrium 및 @Jon McClung으로


실행했는데 security unlock-keychain login.keychain로그인 암호가 작동하지 않았습니다. 그래서 재부팅 한 다음 Xcode를 다시 실행했는데 작동했습니다. 명령 실행도 작동합니다. 이상한 문제.


mac 터미널을 사용하여 한 번 시도하지만 ssh 세션에서는 시도하지 마십시오.

security unlock-keychain login.keychain

그리고 프롬프트 된 대화 상자에서 항상 허용을 선택하십시오. 그런 다음 원격 세션에서 xcodebuild를 수행 할 수 있습니다.


나는 같은 문제가 있었다. 문제가 앱에 서명하는 코드에 있다는 것을 알았다.

Opened the developer account and accepted the updated agreement and it worked.  

enter image description here


As pointed out by @Equilibrium in one of the comments, if you are in command line env. like Jenkins(my case), you might need to pass the password to the security-unlock command mentioned in the solutions.

So instead of using,

security unlock-keychain login.keychain

use:

security unlock-keychain -p <login-keychain-password> <path-to-login-keychain>

where path-to-login keychain can be $HOME/Library/Keychains/login.keychain(my case) or simply login.keychain


for anyone that encountered this issue from jenkins and ssh:

high possibility that you have not granted access to the private key in keychain, i tried but not sure why all of these are not working:

  1. security import .p12 file with -A or -T /usr/bin/codesign
  2. security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k #{password} #{keychainPath}
  3. change all provisioning profile to [UUID].mobileprovision and copy them to '~/Library/MobileDevice/Provisioning\ Profiles' on jenkins server
  4. clean derived data and reboot jenkins server
  5. make sure default keychain is login keychain and unlocked it.

finally resolved by:

1.ssh [user]@[jenkinsServerIP] -L 5900:localhost:5900, log into jenkins server

2.open 'vnc://localhost'

this will launch a remote screen, if your jenkins server allow this...

then open keychain.app to grant access of /usr/bin/codesign to the private key

good luck


Right clicking on the private key associated with the codesigning cert in the keychain, and then clicking on 'allow all applications' instead of relying on a prompt fixed it for me, since the build was happening via ssh.

참고URL : https://stackoverflow.com/questions/24023639/xcode-command-usr-bin-codesign-failed-with-exit-code-1-errsecinternalcomponen

반응형