4

I want to make .a file means static library of my project which I have made. How can I achieve this. Please provide me the the best solution, tutorial or any other links.

Thanks in advance

Sanchit Paurush
  • 6,114
  • 17
  • 68
  • 107
  • possible duplicate of [How to create a static library from an Xcode project?](http://stackoverflow.com/questions/4624604/how-to-create-a-static-library-from-an-xcode-project) – Brad Larson Dec 28 '11 at 17:29

3 Answers3

5

http://mobileorchard.com/sharing-compiled-code-building-static-libraries-in-xcode-for-the-iphone/ has a good tutorial.

Here are the basic steps:

  1. Understand that XIB/NIB/Storyboard files have to be included separately from the library
  2. Add a new target that is a static library
  3. In the build settings for that library, include all of the .h and .m files that are relevant. For example, if your app uses a set of classes to access data and another set to view that data, you may want to just include the files relevant to accessing data.
  4. Build. Use the script provided at Build fat static library (device + simulator) using Xcode and SDK 4+ so that you can use it for iPhone simulator + device.
  5. Include your library + headers + any resources in relevant project.
Community
  • 1
  • 1
tacos_tacos_tacos
  • 10,277
  • 11
  • 73
  • 126
2

With xcode4.2, easiest way is to new project, iOS/Framework & Library, CocoaTouch Static Library, and add all you files existed.

pinxue
  • 1,736
  • 12
  • 17
1

Here is the easiest tutorial with which i have built a static library in iphone. After building a static library you will import a .a library file and the header file .h in your new project and use them. Here is the tutorial link for making static library.

Anil Kothari
  • 7,653
  • 4
  • 20
  • 25