Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When added an embedded framework in an Xcode project, how do you differentiate between Debug and Release?

When I add a framework to my Xcode project, to be embedded in my app bundle, how do I make two different options for whether it's Debug or Release (I have two versions of the framework, one compiled for release and one for debug).

This is what I'm referring to:

enter image description here

As you see, with that configuration, it'll just copy the one on CEF/Debug regardless of whether it's in being compiled in Release or Debug mode.

Ideally I want something like you have for setting:

enter image description here

like image 288
pupeno Avatar asked Nov 09 '22 17:11

pupeno


1 Answers

You can manage frameworks to embed with your custom Run Script in Build Phases:

#!/bin/bash

# Your frameworks to embed
FRAMEWORK="Debug.framework"
if [ $CONFIGURATION == "Release" ]; then
    FRAMEWORK="Release.framework"
fi

# Destination to copy inside the app's frameworks folder
NAME=$(basename $FRAMEWORK)
DESTINATION=${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/$NAME

# Don't copy if it's already copied
if [ ! -d $DESTINATION ]; then
    # Copy the framework to the app's frameworks folder
    cp -r $FRAMEWORK $DESTINATION

    # Sign (if needed)
    codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements $DESTINATION
fi
like image 172
iUrii Avatar answered Nov 14 '22 22:11

iUrii