Best Method for parsing static libraries for iPhone Projects

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.