Recently I encountered some management issues in the project between the projects.
Model:
Where library A is a public base Static library, M_a relies on a, n_a relies on a, and project engineering test relies on the a,m_a,n_a of the three libraries.
Manage projects and dependent libraries with workspace
Test,a Library, M_a Library, N_a library for 4 project, and managed by a workspace, see:
As usual, we will add a.framework in the build Phases->link Binary with libraries of the m_a, n_a Static Library project. Add A.framework,m_a.framework, N_a.framework, in the same location as the test project.
There is no problem compiling.
Duplicate symbols problems arise
But if there is a. m file in a, only the category of the class. Then by default, it will not be loaded. At this point we need to add the-OBJC parameter to the other link flags in build settings. The problem arises at this time, and the duplicate symbols error occurs when compiling test.
This is because Xcode found that there are multiple A's object files, Xcode thought this would cause problems, and then error.
So what if we solve the problem of duplicate symbols? In fact, it is very simple, we compile m_a.framework and n_a.framework when Xcode do not link a.framework just fine. We build Phases->link Binary with libraries delete a.framework in the target configuration of M_a and N_a.
Such as:
Test this target must be added to the dependent library, because it is compiled into a. App must link
Solve the problem of Engineering compilation order
All right. Now compile the test project, find or error, said to find <A/A.h>. But compiled two more times, the third time to find the compilation.
The reason is that in the first two compilations, A.framework,m_a.framework,n_a.framework is compiled to the build path. The third time because the library of test was already there, it was compiled and passed. This actually involves a compilation order problem. Xcode compiles the test project first, and it finds that the desired header file cannot be found (the library it relies on is not yet built).
Xcode is always foresight, it can help us solve this problem. We are in product->schemes->edit schemes. Select the first build in the form on the left. Remove the parallelize build from the front of the find implicit dependencies.
Then the target file A.framework,n_a.framework,m_a.framework in the order of dependency in front of the test, the lower the bottom of the front, and all the check box behind the hook. Such as:
OK after the confirmation, and then compile, found that there is no problem.
Clean Workspace
Also under workspace, if you want all project to be clean, you need to click on the product on the menu, hold down the option key and find that the clean command becomes the Clean Build folder. Click on the Clean Build folder to remove all the Build folders under workspace.
Team collaboration
Companies often have a team to collaborate to complete an app, then how to put the settings can be used for others? The same scheme settings are available when someone else gets the code from the Code warehouse. Then we're going to set the share of scheme.
In Product->schemes->edit schemes->manage schemes ... Pop-up panel, the test project the last side of the checkbox to tick, lib tick does not matter.
Finally, to add this shemes file to the warehouse to submit, before most people may have ignored it, including me, because I feel useless.
Manage engineering with workspace and resolve multiple static library dependencies