186

A while ago I started coding a new iOS app. After a long break from it, I'm working on it again and have it almost complete.

I tested it on the simulator but when I tried to install it on my iPhone 6 (something I have already done in the past), I got an error telling me that my app cannot be installed since the certificate that was used to sign this app expired or has been revoked.

I tried many things:

  1. I deleted all certificates and provisioning profiles from Xcode, keychain, and apple developer and let Xcode create me new ones
  2. I deleted Xcode and did the whole process from the beginning

But this didn't fix my issue.

Any idea what might be the problem?

auspicious99
  • 3,902
  • 1
  • 44
  • 58
user6218736
  • 1,861
  • 2
  • 10
  • 3
  • 3
    you probably may be a victim of [this](http://stackoverflow.com/questions/35402862/this-certificate-has-an-invalid-issuer-keychain-marks-all-certificates-as-inv) – heximal Apr 18 '16 at 08:47
  • 1
    no matter what i do i get :The certificate used to sign "My App Name" has either expired or has been revoked. An updated certificate is required to sign and install the application. – user6218736 Apr 18 '16 at 17:19
  • 1
    do you have correct system date time? – heximal Apr 18 '16 at 21:41

31 Answers31

294

Edit: This answer doesn't work for Xcode 10 and higher. See turkenh's answer.


Solution

First of all, clean the project by holding Shift(⇧)+Command(⌘)+K or Select Product > Clean

Then:

  1. Go to Xcode Menu> Preferences

  2. Select Accounts > Team > View Details

  3. Select any Provisioning profile from the Provisioning Profiles list

  4. Right-click > Select Show in Finder. Then you will see all lists of provisioning profiles

  5. Select all provisioning lists from the folder and move them to the trash

  6. Download All provisioning profiles by clicking Download All below Provisioning Profile lists.

Now, run again and it should work!

auspicious99
  • 3,902
  • 1
  • 44
  • 58
Md.Riduanul Islam
  • 2,949
  • 2
  • 9
  • 5
  • 2
    Yeah.You are right. Xcode's automatic provisioning is the preferred way to code sign apps during both development and distribution. In other words, this is the recommended approach for setting up your projects for both enterprise and App Store developer accounts.Check out the link below for details: https://developer.apple.com/library/ios/qa/qa1814/_index.html – Md.Riduanul Islam Jul 01 '16 at 10:52
  • 1
    You'll have an issue after doing this submitting to the app store, but just change the bundle number and deep clean (Shift+Command+Option+K) and it should work. –  Aug 18 '16 at 23:56
  • Almost. After downloading profiles, I still had the problem. Restarting Xcode did not help. Then, I completely SHUT DOWN and restarted my MacBook, and presto! the problem was resolved. – Mike Taverne May 11 '17 at 18:40
  • Don't forget the "First of all clean the project" part! – Samo Apr 16 '18 at 17:38
  • 3
    Is this outdated? I see no team/view details. – stevejboyer Dec 28 '18 at 18:02
  • 2
    yes, this is outdated. since Xcode10, I also can't see 'view details', it seems the UI has been changed. there are some answers worked for Xcode 10 in below answers, you can try it – Alexa289 Jan 23 '19 at 05:06
  • 1
    I don't see the items of step 2 (Select Accounts > Team > View Details). Xcode 11.2.1 – Cue Nov 24 '19 at 22:29
  • 3
    For xcode 11, simply delete all provisioning profiles at ~/Library/MobileDevice/Provisioning\ Profiles/ (Finder > Go > Library) and restart xcode. Xcode will re-download profiles automatically – Raphael Pinel Mar 20 '20 at 09:06
104

For those who cannot find "view details" button at Account > Team > View Details, here is how I solved this on Xcode 10:

  1. Delete all provisioning profiles at ~/Library/MobileDevice/Provisioning\ Profiles/
  2. Clean the project by holding Shift(⇧)+Command(⌘)+K or selecting Product > Clean (it might be labelled "Clean Build Folder")
  3. Restart Xcode

and try again.

shim
  • 9,289
  • 12
  • 69
  • 108
turkenh
  • 2,564
  • 3
  • 25
  • 32
  • 1
    I has helped me. I am using fastlane and I had to delete all profiles directly from ~/Library/MobileDevice/Provisioning\ Profiles/ Clean the project and reinstall the profiles with fastlane match ... – Vladimír Slavík Jan 30 '19 at 10:01
  • I switched to using 'Automatic Signing' and I was like this doesn't make sense. After deleting the profiles and restarting stuff it worked. Thanks – mfaani Nov 02 '21 at 16:41
  • 1
    It's actually: [ /Users/[YOUR_MAC_USERNAME]/Library/MobileDevice/Provisioning\ Profiles/] – Breno Medeiros de Oliveira Mar 08 '22 at 13:13
83

Edit: This answer doesn't work for Xcode 10 and higher. See turkenh's answer.


I had experienced this problem and was able to find an answer.

The answer which this is coming from can be found here.

Here is what you have to do:

  1. Go to Preferences->Accounts
  2. Press on your account
  3. Click "View Details"
  4. Click "Download All" in the lower left hand corner.

These steps solved the problem for me.

turkenh
  • 2,564
  • 3
  • 25
  • 32
Anthony Dito
  • 3,610
  • 3
  • 29
  • 56
34

I had a slightly different solution. It may have been from updates, or my particular use case.

Using Xcode 7.3.1

I am using a file sharing system (dropbox) to develop on two different machines. Using the Download All solution didn't fix it for me.

Following the link above, I took the advice of

delete all the profiles in ~/Library/MobileDevice/Provisioning Profiles

(which is an extreme measure, but Xcode should now download what you need)

Xcode prompted to update itself.

I still have an issue when switching between developing on the different machines. It presents the following warning/failure:

This application's application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed.

The resolution to that issue is to delete the development item off of the device, and it will then reinstall.

bshirley
  • 8,217
  • 1
  • 37
  • 43
28

A simple "Clean" (Shift(⇧)+Command(⌘)+K) solved to me

marceloquinta
  • 713
  • 12
  • 20
  • I'm a fan of clean and clean build, but I never thought of doing this in this issue! Thank yoiu! :) Please do Command+AltOption+Shift+K to clean your build just to make sure. – Glenn Posadas Jun 15 '17 at 03:51
  • This is good (I do it every time) but not enough. Deleting all provisioning profiles at ~/Library/MobileDevice/Provisioning\ Profiles/ worked for me though. – Raphael Pinel Mar 20 '20 at 09:04
12

Found another case which results in bloody Certificate has either expired or has been revoked error in Xcode 9. If you're trying to sign with valid certificate but you do have another revoked certificate in the same team on your keychain, Xcode throws this error. To check if you do have revoked certificate see Xcode -> Preferences -> Accounts -> Your Apple ID -> Your Team -> Manage Certificates. Deleting revoked certificate with Keychain Access solves this. Looks like another code sign bug in Xcode.

Alexander Vasenin
  • 11,437
  • 4
  • 42
  • 70
12

Update Xcode 13.2.1 (03/2022): This method still works.

In Xcode 11.3.1, the interface has changed from all the current answers.

  1. Go to the menu "Xcode" > Preferences > Accounts.
  2. Select the proper Apple ID on the left for the project.
  3. If the profile is still active, click "Manage Certificates."
  4. If there are any revoked certificates, right click the revoked certificate(s) and "Delete Certificate." In the attached screenshot, the certificate boxed in red should be deleted.

Revoked Certificate Screenshot

Deleting the latest "Date Created" certificate should refresh your certificate, but deleting all the revoked certificates is recommended.

After deleting the revoked certificate(s), you should be able to rebuild the app.

Mykel
  • 1,355
  • 15
  • 25
4

In Xcode 8,

  1. Go to Preferences->Accounts
  2. Press on your account
  3. Click "View Details"
  4. Delete profile which you need
  5. Click "Download All" in the lower left hand corner.
shim
  • 9,289
  • 12
  • 69
  • 108
安仲根
  • 61
  • 3
  • This solved it for me, except I had to press "Download All" like 3 times because of random error messages. – sudo Jan 02 '17 at 20:14
3

It's work for me:

  1. Go to Xcode -> Preferences and select Accounts tab.
  2. Select Your account & on the bottom right Click on Manage Certificates.
  3. You'll see Signing certificate for "User name" manu will pop.
  4. Click on the Apple Development from the bottom like below & then press Done Button.

enter image description here

urvashi koladiya
  • 168
  • 1
  • 11
2

-Open Keychain - Check all certificates by selecting it. - Check status if it is valid or not. -If certificate is not valid then right click on it and delete that certificate

Tarun M
  • 46
  • 3
2

A new problem with Xcode 8, what worked for me was to turn off the new "automatically manage signing" checkbox on the General tab for the target, then turn it back on.

This initiates an on-boarding wizard that sets things up correctly for Xcode 8.

Richard
  • 1,249
  • 16
  • 25
  • This worked for me, but not until I also restarted my Mac, at which point (on starting XCode) a dialog offered me the option of revoking a certificate...I did, then turned on the automatic signing management (which I had unchecked before restarting). +1 for not having to delete any certificates! – kwishnu May 24 '17 at 17:54
2

What finally worked for me was to shut down and restart my MacBook, after downloading latest provisioning profiles.

Mike Taverne
  • 9,156
  • 2
  • 42
  • 58
2

I just unchecked "Automatically manage signing and checked it again with selecting the Team and it worked for me enter image description here

Jack Daniel
  • 2,397
  • 8
  • 33
  • 58
2

I had this issue and it looked like a bug in xcode's 10.x New build system.

  1. Go to File > Project Settings Change the Build system to use Legacy build system.

  2. Deep clean the project by holding Option(⎇)+Shift(⇧)+Command(⌘)+K or holding Option(⎇) and selecting Product > Clean Build Folder

  3. Run on a device

yogevbd
  • 1,548
  • 1
  • 14
  • 18
1

When nor deleting and re-downloading the profiles, nor "Clean" helps I do this:

Preferences> Accounts> Apple IDs> select your acc> select your team> View Details...> reset your signing identity (iOS Development in my case).

This always worked for me.

1

1.Change the setting of your Mac Timing to Automatic(Open Date& Time Preferences Check on set the Date and Time Automatically).

2.After that go to your X Code, Clean and Run The Code.

3.If it failed, log out of your Apple Profile and Delete all the Automatically Created Provisioning Profiles in XCode -- Preferences and Move all the Provisioning profiles to trash and download as a new file.Then LogIn again and Run your Code.

Haileapp
  • 755
  • 7
  • 20
1

If you have a host test target that you run on the device, make sure that it uses the same code signing identity that the app target uses. Otherwise you will have to clean when you switch between testing and debugging the app.

I had this issue in Xcode 11.4.1 when we turned off code signing in our host test target as a build-time enhancement. Once I turned code signing back on for the host test, I no longer experienced this issue when switching between running the host test target and the app!

one eye
  • 11
  • 1
1

1.Go to Xcode Menu> Preferences 2. Account Check whether you are signed in with Apple Developer account

NSSurajit
  • 71
  • 1
  • 2
0

rename your catalog, don't contain Decimal point & 0(zero).

like this, I solve it .

jackyshan
  • 29
  • 3
0

Sometimes the "Bundle Identifier" in Xcode is changing due to some things that you made. Make sure the Bundle Identifier you defined in your Apple Developer account is exactly the same as the one in Xcode.

shim
  • 9,289
  • 12
  • 69
  • 108
Burak
  • 525
  • 4
  • 24
0

Sometime, in Xcode 8 you might find yourself in a revoke-regenerate cycle, where you let Xcode 8 "fix" the certificates and provisioning, then Xcode finds the new/regenerated certificates to be invalid also, and you go back to revoke, and it keeps happening.

In such cases, check your MacOS time! If you have it set to some other time, not the real current time, the new certificate may always "not yet" be valid.

auspicious99
  • 3,902
  • 1
  • 44
  • 58
0

It's not a big issue i faced. Just clean the project and restart your xcode!! Hope it will be working for you! It's working for me. :)

Or First of all clean the project by holding Shift(⇧)+Command(⌘)+K or Select Product > Clean

Then

Go to XCode Menu> Preference

Select Account > Team > View Details

Select any Provisioning profile from Provisioning Profiles list

Right click > Select Show in Finder. Then you will see all lists of provisioning profiles

Select all provisionaling list from the folder and move it to trash

Download All provisioning profiles by clicking Download All below Provisioning Profile lists.

Now, Run again and it should Work!

Jamil Hasnine Tamim
  • 4,389
  • 27
  • 43
0

With Xcode Version 10.1 I solved with these steps:

  1. Go to Xcode, Preferences and select the Accounts tab
  2. In the accounts section click on the gear in the bottom left of the window corner and then click on Export Apple ID and Code Signing Assets... exporting this in a file, for example Test.developerprofile
  3. Delete the profile that you are using
  4. Clicking again on the gear select Import Apple ID and Code Signing Assets... and select your previously exported file Test.developerprofile
  5. Now perform a Clean (Shift(⇧)+Command(⌘)+K) and a Build (Command(⌘)+B)
  6. Run again
madx
  • 6,723
  • 4
  • 55
  • 59
0

I had this issue after changing my Email account.

After trying out so many possible solutions, the only one that worked was the to just delete the certificate that was created in that day from my Apple developer account. (It was not the only certificate in my account) It seems that a new certificate was created automatically and it was conflicting with the main one.

0

Using Xcode 10.3

Follow these steps:

  1. Go to https://developer.apple.com
  2. Follow Account > Certificates, Identifiers & Profiles > Devices
  3. Find your iPhone from the list and click on it. It will open details page
  4. Disable and then Enable it
  5. Go to Xcode select your iPhone and Run it

Do not forget to go Settings > General > Device Management to trust the developer account

iilyasov
  • 23
  • 1
  • 7
0

Xcode 11.1 requires generating сertificate from Xcode directly

So you will have smth like this on https://developer.apple.com after

enter image description here

Svitlana
  • 2,938
  • 1
  • 29
  • 38
0

In case it helps anyone: Xcode 11.x I revoked also (deleted) a certificate in App Developer account. Then I thought I had deleted the certificate too in Keychain access but kept getting error messages, when trying to upload an app update to the AppStore.

I then found out that there are two separate places in keychain access, where in one the certificate is kept (funny enough under keys, once login is selected in keychains) and in the other one the private key (of course under the item certificates in keychains). I made sure that both are deleted and now all is good.

Uwe
  • 65
  • 4
0

You can also get this error due to conflicting Apple Worldwide Developer Relations Certification Authority certificates.

What worked for me was to delete all the Apple Worldwide developer certificates (not the ones that show your company name) in both the system and login keychains in the the "KeyChain Access" app. The a restart and rebuild with Xcode (9.2) and the problem went away.

Aidan
  • 5,346
  • 2
  • 19
  • 18
0

Go to https://www.apple.com/certificateauthority, download all Worldwide Developer Relations - G# certificates and add them to your Mac Keychain. Restart Xcode and try again.

Benoit
  • 680
  • 1
  • 6
  • 17
0

I had this issue and I fixed that.

  1. Go to XCode Menu> Accounts
  2. Select Accounts > Team > View Details
  3. Select Manage Certificates... and You'll see signing certificates menu will pop.
  4. Click on the Apple Development and and press Done button.
Yahya Bn
  • 11
  • 2
0

Update in Xcode 13.2.1,

For me this error cause by I'm using a free apple developer account. So it will be revoked after a specific time not build that app with certificate. But the Xcode is not recognized to rebuild the certificate again -> That's the reason the error happened.

Just do like turkenh's answer but you don't need to restart Xcode. After you clean the certificate will automatically rebuild.

Thang Phi
  • 1,641
  • 2
  • 7
  • 16