If my static library is using AFNetworking and a client project is also using it, it seems like constants defined in AFNetworking will collide, causing the client project not to be able to build (duplicate symbol error). How are things like this resolved usually? What should framework creator do to avoid that?
1 Answers
Try the approach in this link:
http://blog.sigmapoint.pl/avoiding-dependency-collisions-in-ios-static-library-managed-by-cocoapods/
which he describes as:
Build library with prefixed symbols - in my opinion the best way. We would like to add a prefix to all of the symbols in final .a file so that e.g. AFHTTPSessionManager becomes SIGMAPOINT_AFHTTPSessionManager. Your version of dependency is not connected to version used by developer and no collisions occurs. The only disadvantage is bigger output file because when someone uses the same library the final file will contain the same symbols: once prefixed and once not prefixed. But the whole build process will work smooth and without errors. This is the solution we will investigate further in this article.
This tool may help

- 8,438
- 7
- 41
- 48