且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过脚本生成构建时,IPA中不包含SwiftSupport文件夹

更新时间:2023-01-31 18:42:18

PackageApplication 步骤之后,您应该具有 .xcarchive .ipa .我不确定为什么您的原始 .ipa 中没有 SwiftSupport 文件夹(在我的情况下是因为它是为 enterprise 发行版),但是您应该能够将 SwiftSupport 文件夹从 .xcarchive 复制到解压缩后的 .ipa 解压缩步骤:

After your PackageApplication step, you should have an .xcarchive and an .ipa. I can't be sure why you don't have a SwiftSupport folder in your original .ipa (in my case it was because it was exported for enterprise distribution), but you should be able to just copy the SwiftSupport folder from the .xcarchive into your unzipped .ipa, right after the unzip step:

unzip -q "$APP_IPA" -d "$IPA_DIR"

# Copies the SwiftSupport folder from the .xcarchive into the .ipa
mkdir -p "${IPA_DIR}/SwiftSupport/iphoneos"
cd "${archivePath}/SwiftSupport/iphoneos"
for file in *.dylib; do
    cp "$file" "${IPA_DIR}/SwiftSupport/iphoneos"
done

您还可以使用Xcode工具链创建 SwiftSupport 文件夹,如下所示:

You can also create the SwiftSupport folder using the Xcode toolchain like this:

# Creates the SwiftSupport folder from the Xcode toolchain and copies it into the .ipa
mkdir -p "${IPA_DIR}/SwiftSupport/iphoneos"
cd "${IPA_DIR}/Payload/${appName}.app/Frameworks"
for file in *.dylib; do
  cp "${toolchainPath}/${file}" "${IPA_DIR}/SwiftSupport/iphoneos"
done

这会在 .app/Frameworks 文件夹中查找,以查看哪些 .dylib 文件应位于 SwiftSupport 文件夹中.

This looks in the .app/Frameworks folder to see which .dylib files should be in the SwiftSupport folder.

对于Xcode 11,这应该是工具链路径:

For Xcode 11, this should be the toolchain path:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos