-
-
Save adamzarn/6bb89d91ed4b8c3d3fb25363c221441f to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# Usage: | |
# 1. Copy the script into a text editor and save it with no extension | |
# 2. Make it executable like so: chmod +x path/to/script | |
# 3. Run it from the Terminal in one of two ways: | |
# * 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" | |
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 |
@ekapradityagk Maybe try re-signing the new .ipa
. Here's a gist for that, but you need to download fastlane: https://gist.github.com/adamzarn/2721d722dc9e584133167eab98dc2b77
@ekapradityagk Maybe try re-signing the new
.ipa
. Here's a gist for that, but you need to download fastlane: https://gist.github.com/adamzarn/2721d722dc9e584133167eab98dc2b77
so is it the same how to used this script? i'll try download fastlane
@ekapradityagk Maybe try re-signing the new
.ipa
. Here's a gist for that, but you need to download fastlane: https://gist.github.com/adamzarn/2721d722dc9e584133167eab98dc2b77
hi Adam,
where i run this gist? in project root or in the ipa folder? i try run from ipa folder yesterday, but it not finished the script,, stuck in bundle update
Hmm... Hello Guys. I have the same problem like you. Could you help me?
@krzysztofstepnikowski The script performs these steps:
unzipIPA
addSwiftSupportFolder
createAppStoreIPA
cleanUp
You can do it manually. The logic and comments within the script should tell you exactly what you need to do. The script just makes it easier and allows you to add it to a pipeline.
I did it again as you described and uploaded it to AppStore Connect. There is no app store error email reply, and the Appstore Connect TestFlight tab also cannot see the ipa I just uploaded. It has been 2 hours since I uploaded the package.
What I want to ask is, is it necessary to re-sign the entire newly generated xxxx-with-swift-support.ipa, including payload and swiftsupport
Hello Guys,
I forgot to let you know that I resolved this issue. Three things can help:
- Release configuration (The linker should be set as Link Framework SDKs Only and I had added mtoucharguments "-dsym=false", when I removed this redundant arg then was ok).
- Downgraded Xcode to stable version 11.6.
- I recommended uploading app directly by Xcode (not Visual Studio for Mac);
You can do "Archive for publishing" inside the VS4Mac and then open Xcode -> Window -> Organizer. There should be generated your archive to publishing. You can validate the app first and if will be ok then you will can distribute app.
Below I pasted my sample of release configuration from iOS.csproj and URL to screenshot presents the optimal build configuration:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<BuildIpa>true</BuildIpa>
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchEnableSGenConc>true</MtouchEnableSGenConc>
</PropertyGroup>
https://snipboard.io/TF4l5R.jpg
I hope that it can help.
hi,, i also having this issue, found this link on stackoverflow, but i dont know how to use this,, can you help me on how do i use this script?
thanksYeah, what exactly do you need help with? The basic instructions are at the top of the script. Do you have an
.ipa
and an.xcarchive
to start with?okay, i got a .ipa using adhoc archiving method, i saw your post in stackoverflow,
so i just using this .ipa? (i thought this script will run when xcode creating .ipa)
correct me if iam wrong,
i open the terminal on where i put my script file and my ipa folder in download folder so the command will be like this?
script ipa_path="path/to/ipa(in Downloads Folder)" archive_path="path/to/xcarchive" ??
how if i put all this 3 file to 1 folder? can i do that?
script ipa_path=".ipa" archive_path=".xcarchive" can i do this?The script will generate a new
.ipa
called{original-ipa-name}-with-swift-support.ipa
with the SwiftSupport folder added to it. If you use absolute paths you can call the script from any directory. A good way to get the absolute path of the.ipa
and the.xcarchive
is to right click on them, hold option, then Copy "File/Folder" as Pathname.hi,, i sucessfully run the script and i got the new .ipa but after i send to appstore connect i got this email saying i have this issue..
any idea whats wrong ??ITMS-90428: Invalid Swift Support - The files libswiftAVFoundation.dylib, libswiftQuartzCore.dylib, libswiftos.dylib, libswiftCoreFoundation.dylib, libswiftDispatch.dylib, libswiftMetal.dylib, libswiftUIKit.dylib, libswiftCoreGraphics.dylib, libswiftCoreAudio.dylib, libswiftDarwin.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftsimd.dylib, libswiftCoreImage.dylib, libswiftObjectiveC.dylib, libswiftCoreMedia.dylib don’t match /Payload/Principal ID.app/Frameworks/libswiftAVFoundation.dylib, /Payload/Principal ID.app/Frameworks/libswiftQuartzCore.dylib, /Payload/Principal ID.app/Frameworks/libswiftos.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreFoundation.dylib, /Payload/Principal ID.app/Frameworks/libswiftDispatch.dylib, /Payload/Principal ID.app/Frameworks/libswiftMetal.dylib, /Payload/Principal ID.app/Frameworks/libswiftUIKit.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreGraphics.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreAudio.dylib, /Payload/Principal ID.app/Frameworks/libswiftDarwin.dylib, /Payload/Principal ID.app/Frameworks/libswiftCore.dylib, /Payload/Principal ID.app/Frameworks/libswiftFoundation.dylib, /Payload/Principal ID.app/Frameworks/libswiftsimd.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreImage.dylib, /Payload/Principal ID.app/Frameworks/libswiftObjectiveC.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreMedia.dylib. Make sure the files are correct, rebuild your app, and resubmit it. Don’t apply post-processing to /Payload/Principal ID.app/Frameworks/libswiftAVFoundation.dylib, /Payload/Principal ID.app/Frameworks/libswiftQuartzCore.dylib, /Payload/Principal ID.app/Frameworks/libswiftos.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreFoundation.dylib, /Payload/Principal ID.app/Frameworks/libswiftDispatch.dylib, /Payload/Principal ID.app/Frameworks/libswiftMetal.dylib, /Payload/Principal ID.app/Frameworks/libswiftUIKit.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreGraphics.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreAudio.dylib, /Payload/Principal ID.app/Frameworks/libswiftDarwin.dylib, /Payload/Principal ID.app/Frameworks/libswiftCore.dylib, /Payload/Principal ID.app/Frameworks/libswiftFoundation.dylib, /Payload/Principal ID.app/Frameworks/libswiftsimd.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreImage.dylib, /Payload/Principal ID.app/Frameworks/libswiftObjectiveC.dylib, /Payload/Principal ID.app/Frameworks/libswiftCoreMedia.dylib.
@ekapradityagk I'm running into the same error after using the script. I'm building from Xcode 12.1. Did you solve your issue?
@adamzarn Thanks for posting this.
Does the script assume that the app uses Swift so the libraries will be present under Frameworks in the ipa?
I'm pretty sure my app doesn't use Swift but I'm still getting Invalid Swift Support error. It doesn't make any difference if I have "Always Embed Swift binaries" in the build settings set to Yes or No. If I just add an empty folder I get the 90424 SwiftSupport folder is empty error. This is with XCode 12.4
@adamzarn Thanks for posting this.
Does the script assume that the app uses Swift so the libraries will be present under Frameworks in the ipa?
I'm pretty sure my app doesn't use Swift but I'm still getting Invalid Swift Support error. It doesn't make any difference if I have "Always Embed Swift binaries" in the build settings set to Yes or No. If I just add an empty folder I get the 90424 SwiftSupport folder is empty error. This is with XCode 12.4
+1
In my case the error was nothing to do with Swift and was because I was trying to include dynamically linked openssl libraries in my app. Whilst this is fine for running an app in the simulator or on a development device, the Apple Store won't accept random libraries in the Frameworks folder and sends this unhelpful message.
The solution was to link the libraries statically. https://forum.qt.io/post/647893
The script mentioned above does not add all the *.dylib files to swiftsupport directory. Instead use https://github.com/NityaSantosh26/add-swift-support/blob/main/swift-support
before using this script i only having this issue
TMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
already update to latest xcode but still got this error, thats why i follow your solution..