1
votes

I have a library in Objective-C that i want to bind to in monotouch (xamarin studio). This library is using a framework ('Firebase' framework), that I downloaded from a third party vendor. I compiled the library, and it built fine on XCode, and then created the .a files for i386 and armv7 architectures, and used lipo to generate my lib.a file. Now, I created a binding project, and added my .a file to it, which generated a .linkwith.cs file. However, when I used the binding project, it gave the following error:

"ld: framework not found Firebase"

My question is - How do I specify the Firebase framework? I tried this:

[assembly: LinkWith ("libtestfirebaseclient.a", LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true, Frameworks = "CFNetwork Security Foundation Firebase")] 

However, still the problem seems to be un-resolved. Can someone tell me how to create binding for a obj-c library that is depending upon a third party framework?

2

2 Answers

2
votes

You probably do not need to reference Firebase as a platform, but instead (if it's not included in libtestfirebaseclient.a) add a new LinkWith attribute for it:

[assembly: LinkWith ("libtestfirebaseclient.a", LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true, Frameworks = "CFNetwork Security Foundation")]
[assembly: LinkWith ("libfirebase.a", LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true, Frameworks = "CFNetwork Security Foundation")]
1
votes

I would suggest making sure that you have done all of the necessary process like like completing the ApiDefinition.cs file and defined all necessary enums and such in the StructsAndEnums.cs file. Also, I'm pretty sure you don't need to include Firebase in the LinkWith Frameworks section.

In my opinion, the best way to figure it out is to look at existing libraries that have been binded in the monotouch-bindings repository and see exactly how everything needs to be laid out. Download a library that has been bound, look at how each thing corresponds, and do the same for your project.

There is a detailed guide on binding Objective-C Libraries on Xamarin's website along with a Binding Types Reference Guide as a reference.