iOS 使用应用程序商店证书签署企业IPA

use*_*706 4 app-store ios fastlane

我需要找到一种方法让黑盒重新退出工作,最好不需要在退出过程中替换的虚拟 AppStore 分发证书。

背景说明:

我们有一个设置,其中另一个部门有一个辞职作业,可以接收 IPA 并使用自己的证书和配置文件对其进行辞职,并设置适当的捆绑包标识符。

此辞职作业的输入 .ipa 文件之前是使用应用程序商店导出方法以及另一个 AppStore 分发证书和相应的配置文件构建的。这样就可以毫无问题地上传输出 .ipa 文件。

当进行辞职时,替换证书、配置文件和捆绑包标识符是否可以为企业导出方法构建,并且如果无论如何都被替换,则只需辞职?

尝试此操作会在将已签名的 .ipa 文件上传到 AppStore 时出现错误。

ITMS-90426:无效的 Swift 支持 - 缺少 SwiftSupport 文件夹。使用当前公共 (GM) 版本的 Xcode 重新构建您的应用程序并重新提交。

我想这是由于导出方法所致,因为构建配置的其余部分是相同的(尽管使用了适当的证书和配置文件)尝试使用企业证书进行初始签名的原因是输入开发人员程序应该是out-分阶段的。

Ada*_*arn 8

我创建了一个脚本,该脚本会将文件夹添加到缺少该文件夹的文件夹中(即为企业分发生成的文件夹)SwiftSupport:.ipa

#!/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
Run Code Online (Sandbox Code Playgroud)

它也可以作为要点:https://gist.github.com/adamzarn/6bb89d91ed4b8c3d3fb25363c221441f

用法:

  1. 将脚本复制到文本编辑器中并保存(不带扩展名)
  2. 使其可执行,如下所示:chmod +x path/to/script
  3. 通过以下两种方式之一从终端运行它:
  • 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"

如果您有权访问.xcarchive生成 的.ipa,脚本将从SwiftSupport那里获取该文件夹。否则,它将.dylib通过查找.app文件来确定需要哪些文件,然后SwiftSupport从 Xcode 工具链生成一个文件夹。

如果您使用 Xcode 工具链,请确保提供包含文件列表的路径.dylib。这是一个示例路径:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos
Run Code Online (Sandbox Code Playgroud)

对于 Xcode 10,该路径包含一个swift文件夹,但对于 Xcode 11,必须使用swift-5.0.

我已经对此进行了测试,它成功解决了 Apple 提出的 Invalid Swift Support 错误,并且在 App Store 中分发时没有任何负面影响。