Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
923 views
in Technique[技术] by (71.8m points)

xcode - Embedding a framework within a framework (iOS 8+)

iOS applications built with Xcode 6 or higher allow embedding dynamic iOS frameworks within them. I am building a shared framework and would like to embed a sub-framework. How can I accomplish this?

Note: This is possible and is being used in production (for e.g., with Swift frameworks in CocoaPods).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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
    

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...