So randomly after several hours of work this morning on my app, Xcode just stopped letting me test my app on my iPhone. But I can still test it in the simulator.
Now, when I build a project (note: ANY project, even blank single view project that was just created), I get the following error;
Codesigning /Users/name/Library/Developer/Xcode/DerivedData/testProject-brzcahttttlkoqeczajhqslodkkn/Build/Products/Debug-iphoneos/testProject.app/Frameworks/libswiftCore.dylib /usr/bin/codesign '--force' '--sign' '64F8B22715267CC0910110D9C97A2567591C0235' '--verbose' '/Users/name/Library/Developer/Xcode/DerivedData/testProject-brzcahttttlkoqeczajhqslodkkn/Build/Products/Debug-iphoneos/testProject.app/Frameworks/libswiftCore.dylib' 

SecKey API returned: -25304, (null)/Users/name/Library/Developer/Xcode/DerivedData/testProject-brzcahttttlkoqeczajhqslodkkn/Build/Products/Debug-iphoneos/testProject.app/Frameworks/libswiftCore.dylib: unknown error -1=ffffffffffffffff error: Task failed with exit 1 signal 0 {    /usr/bin/codesign '--force' '--sign' '64F8B22715267CC0910110D9C97A2567591C0235' '--verbose' '/Users/name/Library/Developer/Xcode/DerivedData/testProject-brzcahttttlkoqeczajhqslodkkn/Build/Products/Debug-iphoneos/testProject.app/Frameworks/libswiftCore.dylib'
I'm running Xcode 8.2 on macOS Sierra 10.12.12, testing on an iPhone 6s with iOS 10.1.1.
Note: I have reinstalled Xcode after fully removing it from my machine, as well deleting and recreating all my provisioning profiles for all hardware.
shareimprove this question

6 Answers

up vote35down voteaccepted
Ok so I solved this, don't know if it's the right way or not.
Moved my iOS developer certificate from local to system using Key Chain.
Steps:
  1. Close Xcode.
  2. Open Key Chain.
  3. Find the iOS Developer cert in Local.
  4. Drag and drop the cert from Local to the System tab.
  5. Enter admin password when prompted.
  6. Start Xcode and build project for your device.
shareimprove this answer
  • This totally worked, so thank you, but how in the world did you figure it out? In my case it was in the login keychain, so when I dragged it to the System keychain, it actually copied it over, not moved it. – James Toomey Dec 5 '17 at 1:48
  • @JamesToomey Honestly? I don't remember at all. But I do know that in the future if this happens, I know where to look. Hopefully this thread can help people find where to look too. I wish I had more explanation to give, so as to provide a greater understanding, but I don't fully understand it myself haha. – kingfoot Jan 12 at 9:41
  • When I got to step 4 here Keychain said the Cert was invalid. I just deleted the iOS Developer key and created it again in Xcode. Worked fine after that. – Luke Eckley Jan 23 at 1:59
In my case, it was solved by
  1. Close Xcode.
  2. Clean Derived data. <- Open Xcode -> Look at Top Menu Bar > click on Xcode menu on top bar -> preferences -> location tab. Here you can see the path of derived data. Click on the right arrow and delete all files from there. 
  3. Open Xcode.
  4. Clean Product.
  5. Run your app.
shareimprove this answer
What I did to solve it was:
  1. Quit Xcode
  2. Open Keychain Access
  3. Go to Login tab
  4. Drag your certificate into System tab
  5. Reopen Xcode
  6. Run your app
shareimprove this answer
All other solutions didn't work Easiest solution is to use http://freemacsoft.net/appcleaner/ App cleaner, remove Xcode completely with it's resources and preferences (it'll take a while). And re-install Xcode.
The issue happened when Xcode pop-up asking for password (when using simulator), I kept putting it in, and it kept asking for it over and over. So I clicked declined.
When running the Xcode simulator for the first time, make sure you type the password & click Always Allow (Not sure of the wording), it will prompt you 3-4 times.
After that it was Perfect.
shareimprove this answer
First make sure your certificates haven't expired and then follow the steps listed by king foot:
Move the iOS developer certificate from local to system using Key Chain:
  1. Close Xcode.
  2. Open Key Chain.
  3. Find the iOS Developer cert in Local.
  4. Drag and drop the cert from Local to the System tab.
  5. Enter admin password when prompted.
  6. Start Xcode and build project for your device.
shareimprove this answer
I had the same problem - I resolved it by restarting my MacBook several times.
shareimprove this answer

protected by Community Feb 7 at 13:58

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?