1

I'm about to customize a project for several clients. The project uses CocoaPods and Storyboard. Since i'm expecting to fix some bugs and make some changes in the UI for each client along the way, I want to organize the projects like so: 1. Turn the starting iOS app into a compiled Static Library (somehow) 2. Create the new customized app. Link it to the Static Library. 3. Copy the original Storyboard into the new customized App.

Now in the "new" storyboard I can apply changes according to the client needs. Every ViewController in the Storyboard references as Custom Class has a class defined in the original app (now the compiled static library). This way I can always replace or extend original classes and set the new one to be the Custom Class of my ViewControllers in the storyboard.

It sounds good to me. But I can't get it working. 1. I managed to create a static library out of the original iOS app adding a secondary target to the project as Static Library. After struggling with headers search path, flags and linking frameworks I got it compiled (with LOT'S of warnings) 2. I created a new Project and linked the static library but can't get it compiled.

My Question is. 1. Am I doing this the right way? 2. If I have a static library with related header files and I create another static library that uses the previous. If I want to use the second created library into a new project, do I have to link it against both libraries and header files?

user1170896
  • 719
  • 1
  • 7
  • 19

1 Answers1

0
  1. It should work in theory, although I personally would have gone the route of creating a static Framework instead of a static library, since the framework should be easier to link to, can have different versions for different architectures, and includes the header in the same package. Check out this project for adding a Framework project type to Xcode: https://github.com/kstenerud/iOS-Universal-Framework. (Someone REALLY needs to get on Apple to include the Framework target type by default)

  2. Someone can correct me if I am wrong, but as far as I understand things: Yes, you will need to link both libraries into the final executable. Compiling library 2 against library 1 does NOT combine library 1's code into library 2.

We would need to get more specific info on the compilation errors to help you link the static library into your new project.

Chris
  • 452
  • 3
  • 14
  • Yeah I was bit frustrated when I wrote the question and didn't get deep in detail about errors. The point is that reporting those errors would be pretty useless since are specific to my code. Basically it's always about interfaces not found (which means header files not found and/or loaded) even if I double checked header search paths all around. Maybe my project structure based on CocoaPods adds even more complexity to the whole thing. Can you point me to any documentation that explains in detail the world related to libraries (static dynamic) frameworks and so on? Thanks – user1170896 Mar 08 '13 at 08:43
  • It's not so much the specific error messages you're receiving, it would be the TYPE of error that would go a long way. Is it a compiler error (e.g. "Unknown function: doStuff()") or is it a linker error (e.g. "Unresolved symbol: _doStuff"). I don't have a good official documentation page; I learned most of it from this book: http://amzn.to/XvvqhD. They can be equivalent, be frameworks require less work on your part to use. See this SO post, too: http://stackoverflow.com/questions/6245761/difference-between-framework-and-static-library-in-xcode4-and-how-to-call-them – Chris Mar 08 '13 at 16:20
  • It's mostly Interface not defined error. I'm also getting CGFloat not defined even with UIKit and CoreGraphics linked. But I'm having another idea: wrap the original app source code into a Pod, add as dependencies all the Pods. This way I can create a new workspace with all the Pods I use + my homemade Pod. – user1170896 Mar 08 '13 at 17:05