IOS Static library how to, and issues

2019-04-15 00:50发布

问题:

I read about IOS static library creation/issues in many posts, StackOverflow questions, blog and so on... but now i'm really confused :)

Why not to create a unique question to understand this argument and avoid to move across 100 different resources ? I try to merge here some major questions about static library:

  • How to create static a library (i mean best practices ...) ?

  • How to build/compile library in a universal way (Architecture independent) ?

  • How to compile library that can use categories (the "-ObjC, -all_flags" issue) ?

回答1:

I believe this guide and the wiki along with it will be very helpful in assisting whatever you are trying to achieve. Guide Link



回答2:

Check out Karl Stenerud's iOS-Universal-Framework template on github.com. It provides a great template for creating a universal framework that wraps around static libraries. This helps alleviate some of the issues associated with using and distributing static libraries. I've used it on a couple of projects: https://github.com/toolmanGitHub/BDHoverViewController

Good luck.