从脚本生成构建时,IPA 中不包含 SwiftSupport 文件夹
SwiftSupport folder not included in the IPA when generating build from script
该项目位于 Objective-C 中,我们最近向其中添加了一些 swift 文件。它是一个白标应用程序,构建是从服务器生成的。
当我将构建提交到应用商店时出现错误:-
ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
当我调试问题时,我发现从自动化生成的构建现在在 IPA 中具有 SwiftSupport,而当我从我的系统生成构建时确实具有 IPA
我不能在这里 post 整个脚本,因为它确实有重要信息,我不允许分享它,但这里有一些带有一些预定义变量的小片段 :-
function xc_package
{
echo "Building scheme \"\" => "
# Calculated paths
APP_IPA="/$APPNAME.ipa"
APP_APP="/$APPNAME.app"
APP_DSYM="/$APPNAME.app.dSYM"
APP_DSYM_ZIP="/$APPNAME.dSYM.zip"
PROFILE=""
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 -> clean build -> CONFIGURATION_BUILD_DIR -> PROVISIONING_PROFILE_SPECIFIER -> $UUID CODE_SIGN_IDENTITY -> "
#-workspace "Motto_Mobile_New.xcworkspace" \
#-configuration Release
xcodebuild \
-scheme "" \
-configuration Release \
clean build \
CONFIGURATION_BUILD_DIR="" \
PROVISIONING_PROFILE_SPECIFIER="$UUID" \
CODE_SIGN_IDENTITY="" | 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="/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
。我不确定为什么你的原始 .ipa
中没有 SwiftSupport
文件夹(在我的例子中是因为它是为 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
您还可以使用 Xcode 工具链创建 SwiftSupport
文件夹,如下所示:
# 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
文件夹中。
对于Xcode11,这应该是工具链路径:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos
该项目位于 Objective-C 中,我们最近向其中添加了一些 swift 文件。它是一个白标应用程序,构建是从服务器生成的。
当我将构建提交到应用商店时出现错误:-
ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
当我调试问题时,我发现从自动化生成的构建现在在 IPA 中具有 SwiftSupport,而当我从我的系统生成构建时确实具有 IPA
我不能在这里 post 整个脚本,因为它确实有重要信息,我不允许分享它,但这里有一些带有一些预定义变量的小片段 :-
function xc_package
{
echo "Building scheme \"\" => "
# Calculated paths
APP_IPA="/$APPNAME.ipa"
APP_APP="/$APPNAME.app"
APP_DSYM="/$APPNAME.app.dSYM"
APP_DSYM_ZIP="/$APPNAME.dSYM.zip"
PROFILE=""
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 -> clean build -> CONFIGURATION_BUILD_DIR -> PROVISIONING_PROFILE_SPECIFIER -> $UUID CODE_SIGN_IDENTITY -> "
#-workspace "Motto_Mobile_New.xcworkspace" \
#-configuration Release
xcodebuild \
-scheme "" \
-configuration Release \
clean build \
CONFIGURATION_BUILD_DIR="" \
PROVISIONING_PROFILE_SPECIFIER="$UUID" \
CODE_SIGN_IDENTITY="" | 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="/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
。我不确定为什么你的原始 .ipa
中没有 SwiftSupport
文件夹(在我的例子中是因为它是为 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
您还可以使用 Xcode 工具链创建 SwiftSupport
文件夹,如下所示:
# 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
文件夹中。
对于Xcode11,这应该是工具链路径:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos