I recently got a new Macbook Pro and migrated my old data to it. Since then, Xcode refuses to build on a physical device. The simulator works fine (since I don't think it requires code signing).
The error I receive is this: "The specified item could not be found in the keychain."
This happens even when I create a blank project and try to run it. The full error:
Codesigning /Users/bencollins/Library/Developer/Xcode/DerivedData/blank-adueeinllraqwwavbsxjkxivjbde/Build/Products/Debug-iphoneos/blank.app/Frameworks/libswiftCore.dylib /usr/bin/codesign --force --sign 4FF2B0CA211948E47F41C112A5AD1FE24410A574 --verbose /Users/bencollins/Library/Developer/Xcode/DerivedData/blank-adueeinllraqwwavbsxjkxivjbde/Build/Products/Debug-iphoneos/blank.app/Frameworks/libswiftCore.dylib error: The specified item could not be found in the keychain.
I realize it's an error with codesigning. Running "security find-identity -p codesigning" returns 0 identities.
Things I've tried that don't fix the issue:
- Deleting the "login" keychain and creating a new one
- Deleting derived data, cleaning build folder, restarting, etc.
- Using Fastlane to "nuke" all my certificates and provisioning profiles and start over
- Manually moving new certificates and provisioning profiles into Xcode
- Using "--deep" on codesign inside the Cocoapods .sh script
- Restoring my keychain from a time machine backup
- Running this command
I've spent the past day reading every thread on this and it seems to be an issue related to migrating an old keychain to a new mac. The only "fix" I've seen is reformatting the drive and reinstalling OS X, which I would love to avoid (I also do audio work and this creates a literal week's work to track down and reinstall all my old Audio Units and apps).
If there were some solution like deleting the system keychain and starting over, or somehow getting it to recognize my new mac, or creating a new codesigning identity, that would be ideal. I realize that my understanding of the interaction between codesign and keychain may be limited, but I've tried all the articles on Keychain troubleshooting and thus far nothing has worked.