gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 09:34:54 24 4
gpt4 key购买 nike

该项目在 Objective-C 中,我们最近在其中添加了一些 swift 文件。它是一个白标应用程序,构建是从服务器生成的。
当我将构建提交到 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.
当我调试问题时,我发现自动化生成的构建现在有 SwiftSupport 在 IPA 而当我从我的系统生成构建时确实有 IPA
我不能在这里发布整个脚本,因为它确实包含重要信息,而且我不允许分享它,但这里有一些带有一些预定义变量的小片段:-
function xc_package
{
echo "Building scheme \"$3\" => $1"

# Calculated paths

APP_IPA="$1/$APPNAME.ipa"
APP_APP="$1/$APPNAME.app"
APP_DSYM="$1/$APPNAME.app.dSYM"
APP_DSYM_ZIP="$1/$APPNAME.dSYM.zip"
PROFILE="$4"
UUID=`uuid_from_profile "$PROFILE"`

[ -n "$UUID" ] || failed "Failed - missing provisioning profile UUID"
echo "Building with Provisioning Profile $UUID (${PROFILE})"

# Unlock keychain

echo "Unlocking keychain..."
security unlock-keychain -p "$BUILD_KEYCHAIN_PW" "${HOME}/Library/Keychains/login.keychain" || failed "Failed unlocking keychain"


# xcodebuild
XCODE_VERSION=`xcodebuild -version`
XCODE_PATH=`xcode-select -p`
echo "Building with $XCODE_VERSION in $XCODE_PATH profile : $UUID"

export LC_CTYPE=en_US.UTF-8

echo "xcodebuild -> -scheme $3 -> clean build -> CONFIGURATION_BUILD_DIR -> $1 PROVISIONING_PROFILE_SPECIFIER -> $UUID CODE_SIGN_IDENTITY -> $5"

#-workspace "Motto_Mobile_New.xcworkspace" \
#-configuration Release

xcodebuild \
-scheme "$3" \
-configuration Release \
clean build \
CONFIGURATION_BUILD_DIR="$1" \
PROVISIONING_PROFILE_SPECIFIER="$UUID" \
CODE_SIGN_IDENTITY="$5" | xcpretty || failed "Failed building"


# Package IPA
echo "Packaging IPA..."
xcrun -sdk iphoneos \
PackageApplication "$APP_APP" \
-o "$APP_IPA" \
--embed "$PROFILE" || failed "Failed packaging"

# Zip dSYM
echo "Zipping .dSYM..."
zip -qr "$APP_DSYM_ZIP" "$APP_DSYM"

echo "Generating Symbols and repackaging IPA..."

SYMBOLS="$(xcode-select -p)/usr/bin/symbols"
IPA_DIR="$1/IPA_TMP"

rm -R "$IPA_DIR"

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


mkdir -p "$IPA_DIR/Symbols"

echo "$BUILD_KEYCHAIN_PW" | sudo -S $SYMBOLS -noTextInSOD -noDaemon -arch all \
-symbolsPackageDir "$IPA_DIR/Symbols" \
"${IPA_DIR}/Payload/${APPNAME}.app/$APPNAME"


cd "$IPA_DIR" && zip -qr "$APP_IPA" .
}
已使用这些参数调用此函数
xc_package \
"$current_path/build" \
"'preprocess_defines'" \
"Motto_Mobile_New" \
"$profile_fullpath" \
"$certificate_name"

cd ${current_path}
cp "build/${APPNAME}.ipa" "build/${file_name}.ipa"

cp "build/${file_name}.ipa" "/$resourceDirPath/${file_name}.ipa"

最佳答案

在您的 PackageApplication 之后步骤,你应该有一个 .xcarchive和一个 .ipa .我不知道为什么你没有 SwiftSupport原始文件夹中的 .ipa (在我的情况下,这是因为它是为 enterprise 发行版导出的),但您应该能够复制 SwiftSupport来自 .xcarchive 的文件夹进入你的解压 .ipa ,就在 unzip 之后步:

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
您还可以创建 SwiftSupport使用 Xcode 工具链创建文件夹,如下所示:
# 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文件夹。
对于 Xcode 11,这应该是工具链路径:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos

关于从脚本生成构建时,IPA 中不包含 SwiftSupport 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62635971/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com