We use our Enterprise account to test our apps and want to resign the app store build so that we are testing the same binary we release. The resigning succeeds and the app installs on our devices, but crashes immediately when run. (The app store build works flawlessly). The error shown in the logs is:
Bootstrapping failed for <FBApplicationProcess: 0x10ba4b3c0; application<com.pra.bundleidtest.qa>:<invalid>> with error: <NSError: 0x282bf1ce0; domain: RBSRequestErrorDomain; code: 5; reason: "Launch failed."> {
underlyingError = <NSError: 0x282a4b240; domain: NSPOSIXErrorDomain; code: 88>;
}
I can't find anything about this error.
You should be able to resign an app for Enterprise using the app store .ipa file, right?
Can anyone help?
Here's the script I use to resign (no errors and the app installs - the script might not be appearing correctly):
#!/usr/bin/env bash
set -e
set -x
SOURCEIPA="$BITRISEDEPLOYDIR"
SOURCEIPA+="/AppName.ipa"
DEVELOPER="iPhone Distribution: My Enterprise Certificate Name Here"
MOBILEPROV="My Enterprise mobile provisioning file here"
TARGET="$BITRISEDEPLOYDIR"
TARGET+="/QA"
mkdir "$TARGET"
TARGET+="/AppNameQA.ipa"
BUNDLE="com.company.appname.qa"
envman add --key BITRISEDEVIPA --value "$TARGET"
unzip -qo "$SOURCEIPA" -d extracted
APPLICATION=$(ls extracted/Payload/)
cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision"
echo "Resigning with certificate: $DEVELOPER"
find -d extracted \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt
if [[ "$BUNDLE" != 'null.null' ]]; then
echo "Changing BundleID with : $BUNDLE"
/usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE" "extracted/Payload/$APPLICATION/Info.plist"
fi
security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > tentitlementsfull.plist
/usr/libexec/PlistBuddy -x -c 'Print:Entitlements' tentitlementsfull.plist > tentitlements.plist
#/usr/libexec/PlistBuddy -c 'Print:application-identifier' tentitlements.plist > tentitlementsapplication-identifier #save developer application-identifier to file
#/usr/libexec/PlistBuddy -c 'Print:com.apple.developer.team-identifier' tentitlements.plist > tentitlementscom.apple.developer.team-identifier #save com.apple.developer.team-identifier application-identifier to file
var=$((0))
while IFS='' read -r line || [[ -n "$line" ]]; do
#/usr/bin/codesign -d --entitlements :- "$line" > tentitlementsoriginal.plist #save original entitlements from the app
#/usr/libexec/PlistBuddy -x -c 'Import application-identifier tentitlementsapplication-identifier' tentitlementsoriginal.plist #overwrite application-identifier
#/usr/libexec/PlistBuddy -x -c 'Import com.apple.developer.team-identifier tentitlementscom.apple.developer.team-identifier' tentitlementsoriginal.plist #overwrite com.apple.developer.team-identifier
if [[ "$BUNDLE" != 'null.null' ]] && [[ "$line" == *".appex"* ]]; then
echo "Changing .appex BundleID with : $BUNDLE.extra$var"
/usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE.extra$var" "$line/Info.plist"
var=$((var+1))
fi
/usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "tentitlements.plist" "$line"
done < directories.txt
echo "Creating the Signed IPA"
cd extracted
zip -qry ../extracted.ipa *
cd ..
mv extracted.ipa "$TARGET"
rm -rf "extracted"
rm directories.txt
rm tentitlements.plist
rm tentitlementsfull.plist
#rm tentitlementsoriginal.plist
#rm tentitlementsapplication-identifier
#rm tentitlements_com.apple.developer.team-identifier
Bootstrapping failed for <FBApplicationProcess: 0x10ba4b3c0; application<com.pra.bundleidtest.qa>:<invalid>> with error: <NSError: 0x282bf1ce0; domain: RBSRequestErrorDomain; code: 5; reason: "Launch failed."> {
underlyingError = <NSError: 0x282a4b240; domain: NSPOSIXErrorDomain; code: 88>;
}
I can't find anything about this error.
You should be able to resign an app for Enterprise using the app store .ipa file, right?
Can anyone help?
Here's the script I use to resign (no errors and the app installs - the script might not be appearing correctly):
#!/usr/bin/env bash
set -e
set -x
SOURCEIPA="$BITRISEDEPLOYDIR"
SOURCEIPA+="/AppName.ipa"
DEVELOPER="iPhone Distribution: My Enterprise Certificate Name Here"
MOBILEPROV="My Enterprise mobile provisioning file here"
TARGET="$BITRISEDEPLOYDIR"
TARGET+="/QA"
mkdir "$TARGET"
TARGET+="/AppNameQA.ipa"
BUNDLE="com.company.appname.qa"
envman add --key BITRISEDEVIPA --value "$TARGET"
unzip -qo "$SOURCEIPA" -d extracted
APPLICATION=$(ls extracted/Payload/)
cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision"
echo "Resigning with certificate: $DEVELOPER"
find -d extracted \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt
if [[ "$BUNDLE" != 'null.null' ]]; then
echo "Changing BundleID with : $BUNDLE"
/usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE" "extracted/Payload/$APPLICATION/Info.plist"
fi
security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > tentitlementsfull.plist
/usr/libexec/PlistBuddy -x -c 'Print:Entitlements' tentitlementsfull.plist > tentitlements.plist
#/usr/libexec/PlistBuddy -c 'Print:application-identifier' tentitlements.plist > tentitlementsapplication-identifier #save developer application-identifier to file
#/usr/libexec/PlistBuddy -c 'Print:com.apple.developer.team-identifier' tentitlements.plist > tentitlementscom.apple.developer.team-identifier #save com.apple.developer.team-identifier application-identifier to file
var=$((0))
while IFS='' read -r line || [[ -n "$line" ]]; do
#/usr/bin/codesign -d --entitlements :- "$line" > tentitlementsoriginal.plist #save original entitlements from the app
#/usr/libexec/PlistBuddy -x -c 'Import application-identifier tentitlementsapplication-identifier' tentitlementsoriginal.plist #overwrite application-identifier
#/usr/libexec/PlistBuddy -x -c 'Import com.apple.developer.team-identifier tentitlementscom.apple.developer.team-identifier' tentitlementsoriginal.plist #overwrite com.apple.developer.team-identifier
if [[ "$BUNDLE" != 'null.null' ]] && [[ "$line" == *".appex"* ]]; then
echo "Changing .appex BundleID with : $BUNDLE.extra$var"
/usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE.extra$var" "$line/Info.plist"
var=$((var+1))
fi
/usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "tentitlements.plist" "$line"
done < directories.txt
echo "Creating the Signed IPA"
cd extracted
zip -qry ../extracted.ipa *
cd ..
mv extracted.ipa "$TARGET"
rm -rf "extracted"
rm directories.txt
rm tentitlements.plist
rm tentitlementsfull.plist
#rm tentitlementsoriginal.plist
#rm tentitlementsapplication-identifier
#rm tentitlements_com.apple.developer.team-identifier