This week I setup the Jenkins in my Mac and try to build IOS applications. Unfortunately I got the code signing issues , either I use the Xcode plugin or Xcode command line tool. Through a couple days of Googling and I could not the find any solution the works for me, but I finally solve the issue by M Yself through different try out, and the solution is such a easy, now I would like to share with my solution.
The core reason is Jenkins are running as daemon mode in Mac, just assume it's a different user-"Jenkins", so it wil L Not has access to the keychain or provision profiles as a you login using your credentials, which cause the code signing Issue.
I found I have following 2 errors
1. "Code sign Error:there is no valid certificate/private key pairs in the default keychain"
Solution:Copy your IPhone developer certificate from "login" keychain to "System" keychain.
Detailed steps:
Open the "Keychain Access" application, click the Login tab, right click on the certificate like "IPhone developer:you R_name (XXXXXXX) ", choose Copy, then click on the" System "tab, right click Mouse, choose" Paste 2 Items "; You might need to does the same thing with the certificate like "IPhone distribution:your_name".
After doing this, you'll get the second error.
2. "Code sign error:provisioning profiles ' xxxxx-xxxx-xxxx-xxxxx ' can ' t be found"
Solution: Copy The provision profile to Jenkins User folder.
The provision profile was under in the folder
/yourusername/library/mobiledevice/provisioning Profiles,
For example on my machine, the provision profiles files are under/users/steve/library/mobiledevice/provisioning profil Es
In the Mac, the Jenkins'll be in/users/shared/jenkins, create the following folder:
/users/shared/jenkins/library/mobiledevice/provisioning profile, then copy the. mobileprovision file to this folder .
After doing this, the code signing issues would be fixed. Hope my finding'll be helpful to other Jenkins users.