I post the detail of how to fix this issue on my side here:
- In Framework:
- set "$(SRCROOT)/../build" at item "Per-configuration Build Products Path" in Build Setting page;
- shift+cmd+k to clean up the framework build, then cmd+b rebuild the framework;
- In MyApp
- add "$(SRCROOT)/../build" at item "Framework Search Path" in Build Setting page;
- Drag the framework from the product of framework project to "Link Binary With Libraries" in Build Phases page;
- Drag the framework from the product of framework project to "Copy Files" in Build Phases page(you can add the "Copy Files" item by
click the top left of Build Phases page);
Please note if you use one more framework in the same project, and the framework also links to another one like the sample I sent in my question, you also need to do all the steps as above I posted(Steps of Framework and App).
Another problem you will meet if you also use cocoapods in your project like my sample: After you done all the steps above, XCode will response error in your framework project like:
ld: framework not found Pods_xxx.framework
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The "xxx" should be your framework project name. To fix it, you just need remove the Pods_xxx.framework in your project/General/Linked Frameworks and Libraries. The error will be disappeared after you rebuild the project. Here you can find the detail of this problem.
p.s.: the Pods_xxx.framework will appear in General/Linked Frameworks and Libraries after you install pod, so you need remove it again if you run command "pod install"