1

I've a problem managing subprojects in iOS. Here are my projects:

PROJECT A, main project
    - imports B
    - imports C
    - uses D

PROJECT B, personal subproject
    - contains D

PROJECT C, external lib
    - contains D

LIBRARY D  

I need to let project A import subproject B and subproject C, but there is a problem: A, B and C use the same library D (as described).

The solution I've tried was to leave the library D in project C, with this solution A works, B doesn't (it can't read library from C).

Is there a solution (like to let project A to import B except for the library D)?

Thanks!

Charles
  • 50,943
  • 13
  • 104
  • 142
Marco Pace
  • 3,820
  • 19
  • 38
  • 1
    seems like this would be easy if this were a *dynamic* library or framework included in the app package – Michael Dautermann Jun 21 '13 at 13:11
  • Thanks Michael, but i've read that "Dynamic libraries are not supported by iOS and will result in your app getting rejected. Only static libraries are allowed." (from this link: http://stackoverflow.com/questions/4733847/can-you-build-dynamic-libraries-for-ios-and-load-them-at-runtime ) – Marco Pace Jun 21 '13 at 13:14
  • 1
    Hmmm, maybe [weak linking](http://stackoverflow.com/questions/3460090/create-a-static-library-that-can-be-weak-linked) the library? – Michael Dautermann Jun 21 '13 at 13:16
  • Thanks you very much, I'll try it.. It seems interesting! – Marco Pace Jun 21 '13 at 13:20
  • Thanks for helping, but it doesn't work, I'm renaming the library manually to avoid conflicts. Perhaps a solution exists, but unluckly I don't have time to find it :). +1 for good reference, very interesting! – Marco Pace Jun 21 '13 at 14:02
  • wellll... my comments were just random stream of thought comments, not official answers. Somebody else might come up with the correct approach, so you and I will both be watching. – Michael Dautermann Jun 21 '13 at 14:05
  • Static libraries are safe to link with iOS projects. It's just a chunk of code added to the application's bundle. – Abizern Jun 22 '13 at 08:00

1 Answers1

0

One way to do this would be to use Git submodules. That way you have the benefits of only needing to make changes in one place, yet still be able to use the code in different places.

Abizern
  • 146,289
  • 39
  • 203
  • 257
  • Thanks for the comment, but one library is a 3rd part library, so I can't modify it, I have to use it "as is" – Marco Pace Jun 24 '13 at 08:53
  • You can still use it as a submodule in multiple places. You don't have to be able to commit to a repository to be able to use it. – Abizern Jun 24 '13 at 09:11
  • The problem isn't regarding the submodule usage, but how I can use different library based on the same one. In that case XCode gives me an error for "duplicate symbol" – Marco Pace Jun 24 '13 at 09:31