The open-source framework helps you quickly create a shared library to facilitate team development:
Https://github.com/kstenerud/iOS-Universal-Framework
Refer:
Http://blog.csdn.net/kmyhy/article/details/7419222
This is to help encapsulate lib and resource in three steps:
1. Prepare existing projects (for use by others)
2. Drag everything to the realframe project. The compilation items are somewhat special. Exposed. h
3. Drag the files output in 2 to the project using the encapsulated Lib, and then use the imports header and the method/class in the same way as the system Lib.
In project development, shareCodeIs very common.
Due to iOS restrictions, we cannot share code in the form of a "dynamic library. In additionSource codeMethod, we can only select static library to share code.
The "real framework" project shares code in binary form after compilation, which is essentially a static library. However, due to xcode restrictions (no corresponding project template is provided), it is still very troublesome to compile a static library in the form of a framework.
First, you need to download IOS universal framework MK 7. Decompress elc-elcimagepickercontroller-b5357fa.zip. In the extract directory, open the terminal to run the install. Sh script under the realframework directory (that is, "real framework. The real framework will be installed in xcode.
Note: The Install. Sh script requires the root permission.
Now we are going to encapsulate a normal application project as a "real framework" project. This Normal Application project can run independently and has its own window, viewcontroller, and graphic interface.
Of course, you may have another application project. You can encapsulate your application project as a "real framework ".
Drag the resources of this application project: .h file,. M file,. xibfile,. PNG file,. plist file, and even the database file to the testframework project for packaging!
Drag the required header file to the public segment. All header files used when using the framework should be declared as public. In this case, all header files are declared as public.
Then build the project. The compilation result is stored in the "{username}/library/developer/xcode/deriveddata/{project_name_and_random_crap}/build/products/{build_type}" directory. Each build_type directory contains a. embeddedframework and A. Framework file. The. framework only contains code, and the. embeddedframework also contains resources in addition to code. Embeddedframework is generally used.
Note: Sometimes compilation errors such as "undeclared uilable type" may occur. This is because in the application project, the uikit header file is included by default, while the "real framework" project does not include the uikite header file. All the uikit types cannot be correctly recognized by xcode. We only need to add"# Import<Uikit/uikit. h>"Statement.
Ii. Use the "real framework"
Create an application project and drag the. embeddedframework file (actually a folder) to the project folder:
In testframework. embbeddedframework, testframework. Framework is included, and the resources directory contains all resources used by the real framework.
View the Target Builder phases. You can find that the testframework. Framework framework has been included in linkbinary with libraries.
Of course, because the "real framework" does not compile the dependent libraries into the framework file (only reference ), we also need to add other libraries and/frameworks used by the testframework framework to the project (the libraries/frameworks listed in the figure vary with specific projects ):
Now, we can use the real framework in the application:
# Import<Testframework/system. h>
Zookeeper
System* Vc = [[SystemAlloc]Init];
Self.Window.Rootviewcontroller= VC;
[VCRelease];