I m stuck with this error:
Code Sign error: Certificate identity \'iPhone Developer: My Name (xxx)\' appears more than once in the keychain. The codesign tool requir
Xcode 4.3 now searches all keychains for signing certificates but that is increasing the frequency of the build error:
Certificate identity (x) appears more than once in the keychain...
Apple's steps to resolve it are here: "How do I resolve the CodeSign error: Certificate identity appears more than once in the keychain?"
However, if you are affected by the keychain bug mentioned in the final note of that guide, following is a simpler and preferred solution to problem:
1) Keychain Access > Edit > Keychain List, uncheck "Shared" for the login keychain.
2) next, IF going back into the Keychain List you find the login keychain is still marked as Shared, create a backup of the following files and then remove them if they exist:
/Library/Preferences/com.apple.security-common.plist
~/Library/Preferences/com.apple.security.plist
3) Retry your build.
I've had the same issue and I fixed it deleting every certificate from my keychain, every provisioning from my Xcode and every provisioning profile from my device and later... redone it again. I guess, It normally happens when you are working with differents profiles and you have created many certificates for the same provisioning.
I had this issue with XCODE 4.5, because Organizer was still keeping the developer certificates.
If you already deleted all other Developer Certificates in your KeyChain and the Error is still coming up, then try to delete all old/unused keys (private key) with your name. The one that's necessary, is the one with the little "folder-enhancer-icon" next to its name. Keeping this and deleting the rest fixed it for me.
I've had the same issue as well. I think you can get to this state in a variety of ways, but for me, it was because a certificate had recently expired.
What I didn't realize was that Keychain Access will hide expired certificates. Go under "View" and make sure you're not hiding the duplicate certificate.
Try to remove certificates from the xcode organizer.