Error (Xcode): No such file or directory Encountered error while archiving for device

21 views Asked by At

ios folder in my Flutter app has 2 folders Debug and Release. These folders contains firebase plist and json file for respective build type. After creating those folders I have created following build phase script that checks if the build config is release or debug and then copies the respective file into the root.

# Type a script or drag a script file from your workspace to insert its path.
# Name of the resource we're selectively copying
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist

# Get a reference to the destination location for the GoogleService-Info.plist
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
echo "Will copy ${GOOGLESERVICE_INFO_PLIST} to final destination: ${PLIST_DESTINATION}"

echo "Configuration ${CONFIGURATION}"
if [ "${CONFIGURATION}" == "Release" ]
then
    # Get references to dev and prod versions of the GoogleService-Info.plist
    # NOTE: These should only live on the file system and should NOT be part of the target (since we'll be adding them to the target manually)
    GOOGLESERVICE_INFO_PROD=${PROJECT_DIR}/Release/${GOOGLESERVICE_INFO_PLIST}
    
    # Make sure the prod version of GoogleService-Info.plist exists
    echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_PROD}"
    if [ ! -f $GOOGLESERVICE_INFO_PROD ]
    then
        echo "No Production GoogleService-Info.plist found. Please ensure it's in the proper directory."
        exit 1
    fi
    
    echo "Using ${GOOGLESERVICE_INFO_PROD}"
    cp "${GOOGLESERVICE_INFO_PROD}" "${PLIST_DESTINATION}"
else
    # Get references to dev and prod versions of the GoogleService-Info.plist
    # NOTE: These should only live on the file system and should NOT be part of the target (since we'll be adding them to the target manually)
    GOOGLESERVICE_INFO_DEV=${PROJECT_DIR}/Debug/${GOOGLESERVICE_INFO_PLIST}
    
    # Make sure the dev version of GoogleService-Info.plist exists
    echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_DEV}"
    if [ ! -f $GOOGLESERVICE_INFO_DEV ]
    then
        echo "No Development GoogleService-Info.plist found. Please ensure it's in the proper directory."
        exit 1
    fi
    echo "Using ${GOOGLESERVICE_INFO_DEV}"
    cp "${GOOGLESERVICE_INFO_DEV}" "${PLIST_DESTINATION}"
fi

Both these folders are in .gitignore and created runtime in the pipeline But my pipeline is not running successfully and is giving the following error

Archiving com.abc.xyz...
Automatically signing iOS for device deployment using specified development team in Xcode project: 12ABC3D456
Running pod install...                                             87.7s
Running Xcode build...                                          
Xcode archive done.                                         157.0s
Failed to build iOS app
Error (Xcode): /Users/runner/work/1/s/ios/Debug: No such file or directory

Encountered error while archiving for device.

Now if I add another step in my pipeline that adds the Debug folder without any files or anything, the pipeline succeeds.

What I want to know is, what necessitates the creation of the debug folder? If the build type is release then it shouldn't require existence of a Debug folder.

0

There are 0 answers