1

Im using MapBox for my Map SDK and Maply(WhirlyGlobeMaplyComponent) to display a globe on my app. Individually they work fine but they do not seem to work well together.

The problem is that underneath both these libraries use the same classes (not prefixed) and causes a linker problem indicating duplicate symbols in my app. A sample of the linker error is given below (i get multiple such errors)

duplicate symbol _pj_s_eqdc in:
/Users/SagarAdmin/Desktop/Motr-iOS/Motr/WhirlyGlobeMaplyComponent.framework/WhirlyGlobeMaplyComponent(PJ_eqdc.o)
/Users/SagarAdmin/Desktop/Motr-iOS/Motr/MapBox.framework/MapBox(PJ_eqdc.o)

While Maply gives me .a file for the library with Mapbox's iOS SDK does not have a .a file i can work with. I have tried extracting these and combining them into a single library as shown by How to handle duplicate symbol error from 3rd party libraries?

But im not sure if its the right solution for these two libraries.Any work arounds as to how i can use both these frameworks in my project successfully?

Community
  • 1
  • 1
Sagar
  • 555
  • 9
  • 24

2 Answers2

3

If the libraries are really the same, you should just link the library once. In that case just choose one of the two, and remove the other one from the list 'Linked frameworks and Libraries' in your target project settings. That should solve the 'duplicate symbols' issue.

However, if this are two different libraries (but using the same class names), you can not fix this by merging/combining the libraries. You can only resolve it by changing the original code, to make all class names and constants etc unique.

Leijonien
  • 1,415
  • 14
  • 16
2

The problem is that both libraries use the Proj4 projection library, but otherwise do not overlap code. There is a similar issue documented here and the workaround was to rename a function in the MapBox version. This could work with either version but is a pretty common side effect of Objective-C not having namespaces.

incanus
  • 5,100
  • 1
  • 13
  • 20
  • From the thread it would seem like MapBox has included a fix for the duplicate symbol in their SDK. How can i get access to the .framework file with this fix? – Sagar Dec 03 '13 at 10:52
  • This did not happen in the main branch of the project, nor was it included in a `.framework` release. Better to use the CocoaPods or source [install methods](https://www.mapbox.com/mapbox-ios-sdk/#installation) and make the change yourself similarly. – incanus Dec 19 '13 at 01:27