Reputation: 8012
I have written a static library which interfaces with a web service for internal use across multiple projects.
This library uses AFNetworking
heavily, but so do the projects which will use the library. If I include AFNetworking
in the library.
I get duplicate symbol errors, but if I remove AFNetworking
from the library, it won't compile.
How should I address this dependency ?
Edit: My project is in a GIT repository. Whatever I do, other developers should be able to pull the project and have it compile successfully (unless I am wrong and I shouldn't be that way).
Upvotes: 0
Views: 70
Reputation: 21
Use Cocoapods, you can add the dependency for AFNetworking and it will automatically add the library and everything will work like a charm. https://cocoapods.org/
Upvotes: 1
Reputation: 1174
The easiest solution is to rename AFNetworking Classes.
Go to each .m
file of afnetwork, click on class name, then Edit->Refactor->Rename
.There are around 10 files. It wouldn't take you long.
PS: A good practise is to prepend your library initials, for example if your library name is MyLibrary, you can rename AFNetworking classes like MyLibAFNetworking... MyLibAFHTTP....
Upvotes: 1
Reputation: 1178
Copy the files of AFNetworking project and add them to your project as files of your library. In other words,
Cheers!
Upvotes: 0