Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

ios - Umbrella framework

I've created a framework in which is inserted the second framework, the so-called "umbrella framework". When I insert the framework in the test application(embedded binaries and linked frameworks and libraries, both) can not build app, I get the following error:

ld: framework not found 'embeddedInMyFramework' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Than add that framework(embeddedInMyFramework) also in embedded binaries and linked frameworks and libraries and try to build than works ok. Later remove that framework from both, embedded binaries and linked frameworks and libraries and still works fine. Can someone help me with this, not sure what happens when I add framework to embedded binaries for the first time, and how to fix that (could it work somehow without adding to embedded binaries at all)

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

I was able to set up a working Umbrella Framework and wrote down my approach.

Step 5 should remove your linker error ld: framework not found ..


Setup:

  • A Swift based "client" project that has the Umbrella Framework as dependency

  • A dynamic Framework (mainly C++ and ObjC) that is a dependency of the Umbrella Framework


Steps:

  1. Link the Umbrella Framework with its dependent (sub-)Framework and make sure that it is copied into the product upon building.

Setting of Project -> Build Phases


2. Add the location of the dependent (sub-)framework to the Framework Search Paths of the Umbrella Framework project.

Setting of Project -> Build Settings


3. In the "client" project make sure to link and embed the Umbrella Framework

General Setting Client


4. Make sure the Umbrella Framework is copied into the (client-) app bundle to avoid dyld: Library not loaded: @rpath/... errors. The (client-) app, usually under ...Build/Products/Debug-iphoneos/YOUR_CLIENT_APP.app should now contain your Umbrella Framework in a folder called Frameworks.

Project Setting Embed Framework


5. In the "client" project Make sure to add the path to the Umbrella Framework to Framework Search Paths.
If the ld: framework not found '[Framework_Name]' for architecture ... error persists you can also add the path to the (sub-) Framework here.

Project setting framework search path


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...