I'm wanting to use two Objective-C libraries in a MonoTouch app: the Facebook library and an ad library from Millennial Media.
When I try to compile my MonoTouch app (even just for the simulator), I get the error:
ld: duplicate symbol _OBJC_CLASS_$_SBJsonParser in /var/folders/4s/lcvdj54x0g72nrsw9vzq6nm80000gn/T/tmp6024c613.tmp/libMMSDK_4.5.5.a(SBJsonParser.o) and /var/folders/4s/lcvdj54x0g72nrsw9vzq6nm80000gn/T/tmp6024c613.tmp/libFacebookSDK.a(SBJsonParser.o) for architecture i386
collect2: ld returned 1 exit status
I assume both libraries are using SBJsonParser
and that's the issue.
So then I tried putting them in the same MonoTouch binding project, but still got the exact same error.
My bindings came from the Xamarin binding projects on GitHub. Here is what linker flags are setup:
[assembly: LinkWith ("libMMSDK_4.5.5.a", LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, Frameworks = "CoreGraphics QuartzCore MediaPlayer CoreLocation MobileCoreServices AudioToolbox AVFoundation SystemConfiguration UIKit", ForceLoad = true)]
...
[assembly: LinkWith ("libFacebookSDK.a", LinkTarget.Simulator | LinkTarget.ArmV6 | LinkTarget.ArmV7, ForceLoad = true, Frameworks = "CoreGraphics")]
Is there something I can do to fix this? Maybe an extra MonoTouch compiler flag?