Project projects created using Xcode are separate, and if you want several projects to exist at the same time, you can create a workspace workspace. The workspace is a collection of projects, with a suffix of. Xcodeproj for the project file name and a. Xcworkspace for the workspace file name.
Static link library
Some of the core code in the company, we can not provide the source code, but also need to reuse to other companies, teams and other use, this time we need to encapsulate this part of the code into a static link library. Library is not a collection of main function program code, in addition to the static link library and dynamic link library, the difference is that the static link library can be compiled into the execution code, the application can run in the environment without a static link library, the dynamic link library cannot be compiled into the execution code, The application must run in an environment that has a linked library file.
The process of creating a static link library in Xcode is: Select Menu File->new->project ... in Xcode ...,
In the dialog box that opens, select "Cocoa Touch Static Library" in "Framework & Library"
Such as:
The. h file needs to be exposed in the headers in "Build phases".
Using a static library requires that the. A and. h files are provided to the user, and the environment variables need to be configured if necessary.
Framework
For ease of use, Apple provides the framework, which is a collection of resources that contains a static library and its header files into a structure so that Xcode can easily incorporate it into your project.
The process of creating a static link library in Xcode is: Select Menu File->new->project ... in Xcode ...,
In the dialog box that opens, select "Cocoa Touch Framework" in "Framework & Library"
Such as:
The. h file needs to be exposed in the headers in "Build phases".
If you are making a static library, you need to select the static library Setting in the "linking" of "Build" in "Mach-o Type".
Working space
A workspace is a collection of multiple projects. We can integrate static libraries, frameworks, and projects together into one workspace.
The process for creating a workspace is: Select Menu File->new->workspace in Xcode ...
Add Project to workspace, select menu File->add Files to "xxx" in Xcode ... Such as:
Adding a frame into the workspace requires a reference to the link binary with Libraries in "Build phases" to add the framework. Such as:
If you are using the framework, you are prompted with the following error:
dyld: Library not loaded: @rpath/DemoFramework.framework/DemoFramework Referenced from: /var/containers/Bundle/Application/3B829604-B6E1-4C68-966C-83AEB20833A7/Demo.app/Demo Reason: image not found
This is because the framework is set up as a dynamic library, and in the "linking" of "Build Setting", "Mach-o Type" selects the Static library.
Some complex projects need to use module development, it requires engineering and framework, static library integration.
ios-the relationship between engineering and workspace, static libraries, and frameworks