I need to find a way to make a blackbox resigning work again, preferably without having the need of the dummy AppStore distribution certificate which is replaced during resigning.
Background explanation:
We have a setup where another department has a resigning job that can receive an IPA and resign it with their own certificates and provisioning profile and set the appropriate bundle identifier.
The input .ipa file for this resign job had previously been build with the app-store export method with another AppStore distribution certificate and corresponding provisioning profile. This made it possible to upload the output .ipa file without problem.
When doing the resign is replacing certificate, provisioning profile and bundle identifier would it be possible at all to build for the enterprise export method and just resign that if they are replaced anyway?
Trying this creates an error when uploading the resigned .ipa file to AppStore.
ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
I guess it is due to the export method as the rest of the build configuration is the same (despite using appropriate certificates and provisioning profiles) The reason to try doing the initial signing with the enterprise certificate is that the input developer program should be out-phased.
I created a script that will add the SwiftSupport
folder to an .ipa
that is missing it (ie one that was generated for Enterprise distribution):
#!/bin/bash
for ARGUMENT in "$@"
do
KEY=$(echo $ARGUMENT | cut -f1 -d=)
VALUE=$(echo $ARGUMENT | cut -f2 -d=)
case "$KEY" in
ipa_path) ipaPath=${VALUE} ;; # Format: "Path/to/app.ipa"
archive_path) archivePath=${VALUE} ;; # Format: "Path/to/app.xcarchive"
toolchain_path) toolchainPath=${VALUE} ;; # Format: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos"
*)
esac
done
# Derived Variables
ipaDirectory=$(dirname "$ipaPath")
ipaName=$(basename "$ipaPath")
zipName=${ipaName/.ipa/.zip}
appName=${ipaName/.ipa/}
zipSuffix=-unzipped
unzippedDirectoryName=${appName}${zipSuffix}
newIpaSuffix=-with-swift-support
newIpaName=${appName}${newIpaSuffix}
swiftSupportPath=SwiftSupport/iphoneos
ipaSwiftSupportDirectory=${ipaDirectory}/${unzippedDirectoryName}/${swiftSupportPath}
# Changes the .ipa file extension to .zip and unzips it
function unzipIPA {
mv "${ipaDirectory}/${ipaName}" "${ipaDirectory}/${zipName}"
unzip "${ipaDirectory}/${zipName}" -d "${ipaDirectory}/${unzippedDirectoryName}"
}
# Copies the SwiftSupport folder from the .xcarchive into the .ipa
function copySwiftSupportFromArchiveIntoIPA {
mkdir -p "$ipaSwiftSupportDirectory"
cd "${archivePath}/${swiftSupportPath}"
for file in *.dylib; do
cp "$file" "$ipaSwiftSupportDirectory"
done
}
# Creates the SwiftSupport folder from the Xcode toolchain and copies it into the .ipa
function copySwiftSupportFromToolchainIntoIPA {
mkdir -p "$ipaSwiftSupportDirectory"
cd "${ipaDirectory}/${unzippedDirectoryName}/Payload/${appName}.app/Frameworks"
for file in *.dylib; do
cp "${toolchainPath}/${file}" "$ipaSwiftSupportDirectory"
done
}
# Adds the SwiftSupport folder from one of two sources depending on the presence of an .xcarchive
function addSwiftSupportFolder {
if [ -z "$archivePath" ]
then
copySwiftSupportFromToolchainIntoIPA
else
copySwiftSupportFromArchiveIntoIPA
fi
}
# Zips the new folder back up and changes the extension to .ipa
function createAppStoreIPA {
cd "${ipaDirectory}/${unzippedDirectoryName}"
zip -r "${ipaDirectory}/${newIpaName}.zip" ./*
mv "${ipaDirectory}/${newIpaName}.zip" "${ipaDirectory}/${newIpaName}.ipa"
}
# Renames original .ipa and deletes the unzipped folder
function cleanUp {
mv "${ipaDirectory}/${zipName}" "${ipaDirectory}/${ipaName}"
rm -r "${ipaDirectory}/${unzippedDirectoryName}"
}
# Execute Steps
unzipIPA
addSwiftSupportFolder
createAppStoreIPA
cleanUp
It's also available as a gist: https://gist.github.com/adamzarn/6bb89d91ed4b8c3d3fb25363c221441f
Usage:
chmod +x path/to/script
path/to/script ipa_path="path/to/ipa" archive_path="path/to/xcarchive"
path/to/script ipa_path="path/to/ipa" toolchain_path="path/to/toolchain"
If you have access to the .xcarchive
that generated the .ipa
, the script will get the SwiftSupport
folder from there. Otherwise, it will determine which .dylib
files are needed by looking in the .app
file and then generate a SwiftSupport
folder from the Xcode toolchain.
If you are using the Xcode toolchain, make sure you provide a path that contains a list of .dylib
files. Here's an example path:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos
For Xcode 10, the path contains a swift
folder, but for Xcode 11 it's necessary to use swift-5.0
.
I have tested this and it successfully resolves the Invalid Swift Support error raised by Apple without any negative side effects when distributing in the App Store.
This error comes when your binary missing swift support folder. I encountered the same error when I try to build chromium application for iOS. The solution is not easy you need to embed folder yourself. First, you need to check which swift libraries you are using in your third-party like libxswiftCore.dylib
Create folder With name SwiftSupport under that folder create iphoneos folder, place all the required dylib file inside this folder, make sure these dylib files should be signed by worldwide apple certificate, not your own certificate. after that create one more folder Payload and place your .app file inside that. make sure SwiftSupport and Payload should be on the same hierarchy. make sure your zip should not contain .DS_Store file, remove those files. I created a script for this work but that company property, let me know if this still not work for you. or you can write an email to me. mshauket.developer@gmail.com
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.