When I run my app into my iPhone I get this Warning:
unable to build chain to self-signed root for signer "".
My application Installed in iphone but it closed suddenly.
When I run my app into my iPhone I get this Warning:
unable to build chain to self-signed root for signer "".
My application Installed in iphone but it closed suddenly.
In my case,
1- Open Keychain Access
2- Select login, and click Certificates
3- Double click Apple Worldwide Developer Relations Certificate Authority
4- Open trust section, and set to "Use System Defaults" from "Always Trust"
5- Clean build folder and run
I too had the same error unable to build chain to self-signed root for signer...
My mistake was that I had changed the trust setting of my distribution / developer cert to always trust. When I changed it back to Use system Default it all worked.
I saw other answers and attempted to delete my intermediate keychains and root certificate. But Apple doesn't allow to remove Root certs unless you're in recovery mode and I didn't want to try that. Likely you don't have to delete anything either as this solution works without it.
I just thought I'd add an image to clarify things. I ran into this issue when I was poking around in my Keychain and accidentally changed the default settings.
I'm not 100% sure, but I think when you set an Apple certificate to "Always Trust", it can cause app signing problems because it allows the certificate to bypass the standard chain of trust.
In the context of app signing, a chain of trust refers to a series of interconnected certificates that form a secure path from the app's signature to a trusted root certificate.
IIUC only root certificates can be set to 'Always Trust'. But even then it's better to let the system resolve it for you i.e. for all certificate types, you just want it to be set to "Use System Defaults"
Keychain will tell you which ones are Root certificates.
I had the same problem and basically did like posted in the comment:
The issue could be having your certificate set to always trust, that's the issue I had. If you're getting this warning that stops you from running apps on your device, this should fix everything.
After days of trying to find a consistent way, here is the solution:
It seems like a hack but it works!
Go to Xcode Preferences menu (command+,) and then Accounts tab
click on the gear icon on the bottom left and Export Apple ID and Code Signing Assets...

Set a password for the export
⚠️ You are going to delete all passwords and profiles! Don't forget your password! Writing down your password is highly recommended.
⛔️ This file will contain all your accounts and profiles. Make sure to keep it very secure.
Delete all accounts.
Build and face the new error.
Import them back using your password.
It's working again.
After struggling one day with many answer on forum. I came up with solution works for me. below are steps for fix:
Root Certificate Apple Inc. Root Apple Root CA - G3 Root
Intermediate Certificate Worldwide Developer Relations - G1 (Expiring 02/07/2023 21:48:47 UTC) Worldwide Developer Relations - G3 (Expiring 02/20/2030 00:00:00 UTC)
- Relaunch Keychain and go to login section of Certificate tab
- Drag drop root certificates to keychain (root certificate will be trusted automatically do not make it manually )
- Drag drop intermediate certificates to keychain
- Drag drop app specific certificate (.p12) to keychain
This issue happens due to apple has introduced new root certificate and intermediate certificate. Read more detail from https://developer.apple.com/support/wwdr-intermediate-certificate/
xcode -> preferences -> accounts -> select the account -> manage certificate -> click on the + icon on the bottom left of the popup window -> ios development
THen you will see a new certificate created. Now you can run your app.
Download the renewed cert here: https://developer.apple.com/support/expiration/
For me, just performing Product > Clean Build Folder in Xcode was enough to fix the issue.
I'm adding the solution that fixed it for me, and is already on that thread
The key issue here is the root certificate
Export and delete from login/certificate the certifictes named "Apple Worldwide Developer Relations Certification Authority" in your Keychain.
Do the same from system/certificate.
Import in system/certificate only ONE "Apple Worldwide Developer Relations Certification Authority". I imported the one that has the expiration date set to 2030 (not 2023).
You can also download the latest from: https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer
That's all. But again, make sure it is in your Keychain's SYSTEM and you ONLY have ONE root certificate in your Keychain's SYSTEM area, AND NONE in LOGIN area.
You are using Distribution certificate instead of Development Certificate if you are able to install app in debug mode but it closes automatically once installation completed.
One of the way to resolve IOS Codesigning issue is follow following Document.
iOS Code Signing Troubleshooting
And Run the following command to know the excact issue
spctl -a -t exec -vv <app-path>
One More Tip
After changing anything in system always clean & build your project to know if solution got applied successfully or not.
It is also important to note that the physical device you are trying to deploy to must be listed in the allowed devices list for that provisioning profile -> you can see this here in the tooltip that pops up from your cert information -> you want to make sure that your device is listed in the "Devices" section.
You can add / remove devices when you create the provisioning profile on the apple developer portal website.
For me the problem was caused by the presence of two Fastlane Match certificates, one of them being invalid:
For some reason codesign was picking up the invalid one. Once I deleted that certificate, things got back to normal.