App failed to launch "No such process" / certificate untrusted issue

Published

I’m trying to automate the creation of an .ipa file for development step.
I have an enterprise licence, and I use a distribution cert. (It’s a Distribution certificate for an Enterprise distribution. So I don’t publish on app store)

Here my code so far, I try to do the whole signing process manually:

#!/bin/bash 
PROFILE_PATH="XX/XXX/XXX.mobileprovision"
PROFILE_NAME="XXXXXXX"
KEYCHAIN="/Users/XXXX/Library/Keychains/login.keychain-db"
PASSWORD="XXXX"
CERT_PASS="XXXX"
CERT_PATH="./XXX/XXX"
ARCHIVE_PATH="./XXX/myApp.xcarchive"
IPA_PATH="./XXX/myApp.ipa"
EXPORT_PATH="./XXX/exportHouse.plist"


sleep 5

open "${PROFILE_PATH}"

sleep 5

security list-keychains
security unlock-keychain -p ${PASSWORD} ${KEYCHAIN}
security -q import ${CERT_PATH}.p12 -k ${KEYCHAIN} -P ${CERT_PASS}  -T /usr/bin/codesign
security set-keychain-settings ${KEYCHAIN}
security set-key-partition-list -S apple-tool:,apple: -s -k ${PASSWORD}

# Make the archive file
xcodebuild 
  DEVELOPMENT_TEAM="4CVDA82G9X" 
  PROVISIONING_PROFILE_SPECIFIER=${PROFILE_NAME} 
  CODE_SIGN_IDENTITY="iPhone Distribution" 
  CODE_SIGN_STYLE="Manual" 
  OTHER_CODE_SIGN_FLAGS="--keychain ${KEYCHAIN}" 
  -scheme ispektor 
  -workspace ./platforms/ios/myApp.xcworkspace 
  -archivePath ${ARCHIVE_PATH} 
  archive

sleep 5
# Make the IPA file 
xcodebuild 
        -exportArchive 
        -archivePath ${ARCHIVE_PATH} 
        -exportPath ${IPA_PATH} 
        -exportOptionsPlist exportAppStore.plist 
        -exportOptionsPlist ${EXPORT_PATH} 

Problem :

I can download the ipa file; however, when I launch it on my phone, it opens and closes immediately :

When we look at logs we have (I’ve selected only the related parts):


Executing launch request for application ...

Submitting job ...

 <Error>: failed to get pid for label UIKitApplication: No such process (3)

 <Error>: Failed to start job for application<com.myApp.mobileApp>: <NSError: 0x100545e20; domain: NSPOSIXErrorDomain; code: 3; reason: "No such process"> {
    userInfo = {
        RBLaunchdOperation = launch_get_running_pid_4SB;
        RBLaunchdJobLabel = UIKitApplication:com.myApp.mobileApp[7207][rb-legacy];
    }
}
<Notice>: Trust evaluate failure: [leaf AnchorApple ChainLength IssuerCommonName LeafMarkerOid MissingIntermediate SubjectCommonName]

Potential cause : I think this come from my initial certificate, as I import it manually on line 21, this certificate is "not trusted" .And When I do everything with xcode and set "Automatically manage signing" it works.

When I manually force "always trusted", I can’t compile :

note: Constructing build description
error: Invalid trust settings. Restore system default trust settings for certificate "iPhone Distribution: XXXX" in order to sign code with it. (in target 'myApp' from project 'myApp')

And when it says "restore" it mean trust –> untrust.

So I need to do the same as "Automatically manage signing " but with CLI.

Source: Ios Questions

Answers

The reason your distribution certificate was signed by the Apple Worldwide Developer Relations Certification Intermediate Certificate that expires in 2030, not the former one that expires on February 7, 2023. Even though it is still a few more years to 2023, the best practice for certificate renewal is to do it early, e.g., with a 3rd of its lifetime left before expiry, and then to stop signing with the previous certificate (even though it still hasn’t reached its expiry yet).

In your case, as Apple explains,

The current Apple Worldwide Developer Relations Certification Intermediate Certificate is set to expire on February 07, 2023. The renewed certificate will be used to sign new iOS Distribution Certificates issued after September 2, 2020 for the Apple Developer Enterprise Program.

So your distribution certificate was most likely issued after September 2, 2020, and therefore signed with the Apple Worldwide Developer Relations Certification Intermediate Certificate that expires in 2030.


Elias Zboncak

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq