Getting a "certificate is not trusted" error for iOS Distribution Certificate

To support an older version of an iOS app, I needed to install Mojave with Xcode 9.

I create a CSR and from there generate an iOS Distribution certificate online, which I download and double click to install in Keychain. However, when viewing in Keychain, it shows in red "iPhone Distribution: CompanyName certificate is not trusted".

I'm not sure what I'm doing wrong as I follow the instructions to the T and have done this in the past with success.

NOTE: I tried this with Sierra as well and got the same issue. It only seems to work on Catalina, which doesn't help me because I need an older version of Xcode.

Great, thank u very much

@patelgaurav4u_ios even in 2023, you are still a legend.

Some added information to @patelgaurav4u_ios answer:

  1. Look on your certificate info, which apple organization unit was it issued by , e.g. G3, G4, G6 etc..
  2. Open keychain -> System Roots Certificates
  3. Search for "Apple Worldwide"
  4. Check all your your certificate and their Organization unit (e.g G4 etc..)
  5. Unit that was your untrusted certificate issued by is propably missing there..
  6. Download certificate from the same organization Unit that is on your "untrusted" certificate from this Apple site
  7. double click the Apple Worldwide relations certificate
  8. your previously "untrusted" certificate shoulb be trusted and marked green by now
Getting a "certificate is not trusted" error for iOS Distribution Certificate
 
 
Q