Deep Arora
Deep Arora

Reputation: 2040

Header file inclusion and visibility in static library iOS

When a static library is created from an iOS project, in Lib.a file, does it have all the header files also bundled into it. Or should I mark all the header files that will be used by public header as private headers which then add all private files in /usr/local/include folder once the static library target is build?

Upvotes: 0

Views: 695

Answers (1)

David Hoerl
David Hoerl

Reputation: 41622

No, nothing happens automatically. The normal process for static libraries is as follows:

  • have a static library target in your project, so you can include the project in an app and verify functionality

  • create a Run Script and Aggregate target so that you build one .a for iOS and one for the simulator, then "lipo" them together into one .a

  • in the run script, copy the .a and all the necessary .h files into some folder you create

The folder is then what you distribute. The user links to the .a, and sets the Search Paths in their app project to point to the folder with your .a.

Upvotes: 1

Related Questions