App failed to launch : "No such process"

I try to automate the creation of .ipa for development step.
I have an enterprise licence, and I use a distribution cert.

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

Code Block
#!/bin/bash
PROFILE_PATH="XX/***/***.mobileprovision"
PROFILE_NAME="XXXXXXX"
KEYCHAIN="/Users/XXXX/Library/Keychains/login.keychain-db"
PASSWORD="XXXX"
CERT_PASS="XXXX"
CERT_PATH="./***/***"
ARCHIVE_PATH="./***/myApp.xcarchive"
IPA_PATH="./***/myApp.ipa"
EXPORT_PATH="./***/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 could download the ipa file and launch it on my phone, but it open and close immediatly :

When we look logs we have ( I select the more interesting) :
Code Block
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 :

Code Block note: Planning build
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 he said "restore" it mean trust --> untrust.

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

Thanks by advance,



App failed to launch : "No such process"
 
 
Q