3

When archiving an app in XCode (Product > Archive) I get the following error:

CodeSign /Users/xxx/Library/Developer/Xcode/DerivedData/name-xxx/Build/Intermediates/ArchiveIntermediates/name/InstallationBuildProductsLocation/Applications/name.app
cd /Users/xxx/Documents/name/App/platforms/ios
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "iPhone Developer: xxx xxx (S5L8942T98)"
Provisioning Profile: "iOS Team Provisioning Profile: xxx"
                      (xxx)
/usr/bin/codesign --force --sign xxx --entitlements /Users/xxx/Library/Developer/Xcode/DerivedData/name-xxx/Build/Intermediates/ArchiveIntermediates/name/IntermediateBuildFilesPath/name.build/Release-iphoneos/name.build/name.app.xcent --timestamp=none /Users/xxx/Library/Developer/Xcode/DerivedData/name-xxx/Build/Intermediates/ArchiveIntermediates/name/InstallationBuildProductsLocation/Applications/name.app

error: The specified item could not be found in the keychain.

I revoked all my certificates and created new provisioning profiles, unfortunately it didn't help.

I found this thread, but I don't think it's related. Obviously something is missing in my keychain, but what?

Edit:

This is a screenshot of my keychain:

enter image description here

The Id matches the one from the error code.

Community
  • 1
  • 1
user3255061
  • 1,757
  • 1
  • 30
  • 50
  • Try deleting derived data & restart xcode, clean project & then archive – iYoung Feb 18 '17 at 10:19
  • is your account is login in xcode. – Fahad Jamal Feb 18 '17 at 11:40
  • @iYoung: I followed the steps here: http://stackoverflow.com/questions/38016143/how-to-delete-derived-data-in-xcode-8. Unfortunately it didn't solve the issue. – user3255061 Feb 18 '17 at 18:10
  • @FahadJamal: Yes, it appears as if the account is logged in. – user3255061 Feb 18 '17 at 18:11
  • Seems like the developer profile is not added in keychain. Please check that once – iYoung Feb 18 '17 at 18:18
  • It is, but as said I created new ones, so maybe they're old. I now deleted all old profiles from the keychain and downloaded the new ones from developer.apple.com. I double-clicked them, but they don't show up in the keys section of the keychain. I restarted my computer and re-did the steps, unsuccessfully. Is this the correct way to add keys to a keychain? According to google it should be. Also thought I maybe just can't find them and they're there, but signing the app still doesn't work. – user3255061 Feb 18 '17 at 19:18
  • @user3255061 can you take a screen shot of your keychain access. or instead of selecting the automatic profile to assign in the Xcode -> General, try to provide it by yourself the debug and release signing profiles – Fahad Jamal Feb 19 '17 at 06:08
  • @FahadJamal: Thanks a lot for your efforts. I tried to sign manually by unchecking this automatic thing, unfortunately it still doesn't work. I added a screenshot above in my question. The code in the certificate matches the code in the error message - so I guess the item is in fact in the keychain? – user3255061 Feb 19 '17 at 22:31
  • 1
    I wasn't able to find a solution and had to re-install my OS completely. – user3255061 May 03 '17 at 18:48
  • @user3255061 Did you by chance do a migration to a new mac when this started happening? – Ray Hunter Jul 20 '17 at 23:08

1 Answers1

1

The simple solution is to go to Derived Data (XCode > Preferences > Locations > Click on the arrow next to the derived data directory), and delete the folder named after your app.

As an extra measure you can restart XCode and Clean the project after the first step, but it might not be necessary.

Jacobo Koenig
  • 11,728
  • 9
  • 40
  • 75