Categories
Mastering Development

SwiftSupport folder not included in the IPA when generating build from script

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.

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.

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"

build/./mresign -i "/automation/mycityv3/build/${file_name}.ipa" -c "${certificate_name}" -m "$profile_fullpath"

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

Leave a Reply

Your email address will not be published. Required fields are marked *