CodeSign error: Certificate identity \'iPhone Developer: XXXX (12345678)\' appears more than once in the keychain. The codesign tool requires there only be one.
So I
I was having trouble with zombie certificates being repopulated into my keychain and the certificate identity appearing twice. Simply deleting the duplicate cert did not work.
In Xcode, when I looket at my Code Signing in the target, I remembered I had a different distribution profile in "Ad Hoc" builds than "Release" builds.
When I generated a new certificate, I only downloaded a new profile for Ad Hoc builds, and not for Release builds.
Xcode was hanging onto the certificate for both of those profiles, and Xcode was therefore causing the duplicate certificates... because I forgot to update my profiles properly.
Make sure to update ALL your provisioning profiles to the new certificate, and change ALL the profiles at the same time in Xcode.