IPhone ProjectUseStatic LibraryThe best way is to introduce the content of this article, mainly to learn how to useIphoneInStatic Library. Because Apple prohibitsIPhoneTo use external frameworks or dynamic link libraries, you must reuse third-party libraries or your own code.) You can only select the following method:
Add the Code directly to the project. This method is a bit stupid. For example, if a piece of your code is shared by five projects and you find a small bug, you need to change five places. Is it troublesome? Use a static library. This is a frequently used method. However, Xcode does not provide a static library template for the iPhone. There are two solutions:
If your project uses Objective-CC/C ++ and you only need to make some simple modifications), you can use the ready-made Xcode template. Use the BSD Static Library in the Static Library under the Mac OS X column to create a Static Library. But to use the iPhone project, you still need to modify the Base SDK of the project to the iPhone ).
But how can I link a static library to a project? If you are familiar with Xcode, skip this section. Simple:
The header file path of the static library is Head Search Paths.
Add the static library to the Xcode project.
That's simple. But it's slow. Is everything okay? What if you want to modify your static library? You need to Find your static library project from Find and open it to modify it. It's a little troublesome. Isn't it possible to include related projects in the application project like Visual Studio? The answer is: yes, although there is still no workspace in Visual Studio to use. However, you can open the relevant static library directly from Xcode. The method is to use Xcode's Cross-Project Reference (Cross-Project Reference ).
Add the Xcode project of the static library to the current project.
Right-click the project under Targets and add it to the association of the static library project.
Under the project, expand the static library project and drag xxxx. a to Link Binary With Libraries under Targets.
In this way, you can double-click the static library project under the current project to open and modify the static library code.
Summary: AnalysisIPhone ProjectUseStatic LibraryThe content of the best method has been introduced. I hope this article will help you!