通过脚本生成构建时,IPA中不包含SwiftSupport文件夹 [英] SwiftSupport folder not included in the IPA when generating build from script

查看:128
本文介绍了通过脚本生成构建时,IPA中不包含SwiftSupport文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该项目位于Objective-C中,我们最近向其中添加了一些快速文件.这是一个白色标签应用程序,其构建是从服务器生成的.

The project is in Objective-C and we recently added some swift files into it. It is a white label application and builds are generated from the server.

当我将构建提交到appstore时,它给出了错误:-

When I submit the build to appstore it gave error :-

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

When I debugged the issue I find out the build generated from automation is now having SwiftSupport in IPA while when I generate the build from my system is does have the IPA

我不能在此处发布整个脚本,因为它确实具有重要信息,并且我不能共享它,但是这里有一些带有一些预定义变量的代码段:-

I cannot post the whole script here because it does have important information and I'm not allowed to share it but here a little snippet with some predefined variables :-

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" .
}

已使用这些参数调用了此函数

This function has been called with these parameters

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 解压缩步骤:

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

这篇关于通过脚本生成构建时,IPA中不包含SwiftSupport文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆