Embedding a framework within a framework (iOS 8+)

3 Solutions Collect From Internet About “Embedding a framework within a framework (iOS 8+)”

Found the answer. Here’s how it’s done:

  • Navigate to Target > Build Phases
  • Click the small “+” icon and select “New Run Script Build Phase”
  • Paste the following:

    cd $BUILT_PRODUCTS_DIR
    
    mkdir $PROJECT_NAME.framework/Frameworks &>/dev/null
    
    for framework in *.framework; do
        if [ $framework != $PROJECT_NAME.framework ]; then
            cp -r $framework $PROJECT_NAME.framework/Frameworks/ &>/dev/null
        fi
    done
    

@Vatsal Manot’s answer was very helpful for me. I modified it a bit and also had a need to sign the copied embedded framework. My script is below.

cd $BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Frameworks/Custom.framework/Frameworks
for framework in *.framework; do
    mv $framework $BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Frameworks/
    /usr/bin/codesign --force --sign "iPhone Developer" --preserve-metadata=identifier,entitlements --timestamp=none $BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Frameworks/$framework
done

To create a Umbrella Framework that contains a Sub-Framework you can follow the step-by-step guide written down here: Umbrella framework