Forum Xamarin.iOS

How create a binding library starting from a framework boundle?

BadStormBadStorm ITMember ✭✭

I need to create a binding library for an objective-c close source library. Since is close-source I cannot have access to source, but I have the .framework.

Those are the steps that I follow:

  1. In Xamarin Studio create a new Binding Library project.
  2. From the .framework folder I get the binary inside, rename it with ".a" extension and add it to the binding project.
  3. With Objective Sharpie I extract from the .h file inside the .framework all the Api Definitions and Enum and Structs. Copy them to the related files in the binding project.
  4. Compile it with no errors.
  5. Create a new ios project and link the binding library.

When I try only to add "Using BiningLibraryNamespace;" to the controller .cs file on the ios project, the app crashes on start.

What I forgot?

Thanks a lot.


  • MurielSilveiraMurielSilveira USMember

    +1 Same doubt!

  • LucasTeixeiraLucasTeixeira USMember ✭✭

    You don't have to extract the framework.

    Here's a binding I did using a .framework:

    ps: The original code is in Swift 2, making it a little bit more complicated. To solve that I created a NuGet pack (Xamarin.SwiftSupport) including all Swift dependencies and some MSBuild instructions.

  • MatteoMonizzaMatteoMonizza ITBeta ✭✭

    Hi Lucas, Im' tryng to adding your bind to a test project to see how it works but the app crash on start if I use one of the reference.. What I'm doing wrong?

  • JavierHolcmanJavierHolcman ARMember ✭✭

    @LucasTeixeira @BadStorm could you fix this crash? I am fighting with this too and there is no threads or documentation about it. Any help would be appreciated.

  • LucasTeixeiraLucasTeixeira USMember ✭✭

    @JavierHolcman the common causes for crashes on startup (actually when it is loaded, not exactly app loading) when binding Swift libraries is:

    1. Lack of the Swift runtime or the incompatibility of the Swift runtime with the library itself.
    2. Lack of a specific runtime library - you may have added libswiftCore.dylib, but libswiftCoreFoundation.dylib is missing. The ones required depend on each project.
    3. If a library was built against Swift 4.1, you need to use the Swift 4.1 runtime. Minor version changes in the runtime can break it!

    Please make sure you are adding the correct runtime version to your project.

    You can read more about it on

    You can found more about the runtime libraries in here

    A good step for you to try is:
    1. Figure out what is the Swift and Xcode version used for the library you are binding or using
    2. Go to Nuget packages listed in and search for the release version that gives support for that specific Xcode version.
    3. Install all the 41 packages

    That is a lot of packages, you don't need it all and most likely don't want to publish the app with it all because it increases the app binary size. Do it just to diagnose the problem. If you don't want to install all packages you can follow the instructions on There is a way to discover what are the necessary runtime libraries you need.

    You can also go to the device logs and see what is the log report for the startup crash, when it is a binary missing it will say something like "libswiftCoreAudio.dylib was not found". A runtime incompatibility the error message will say something like: "couldn't find ******** method".

  • JavierHolcmanJavierHolcman ARMember ✭✭
    edited May 2018

    Thank you for your quick response. The main issue I have is the framework isn't build on swift. Indeed, I don't have the code at all. It is a cocoa pod: ForeSee. I can't see the code, but I am almost sure it is built with obj-c. However I will try adding all the swift supports libraries.

    On the crashlog, it shows this:

    Application Specific Information:
    dyld: launch, loading dependent libraries

    Dyld Error Message:
    Library not loaded: @rpath/ForeSee.framework/ForeSee
    Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/97F357C7-0E9C-4388-ADE0-84D37F7A0C25/data/Containers/Bundle/Application/9F4083AA-087E-42AE-B27C-EE6C07B2BA25/
    Reason: image not found

    Binary Images:
    0x10c56a000 - 0x10c996ff3 +com.wappsfactor.ForeseeDemo (1.0 - 1.0) <4CF2BD66-F486-316A-91F7-AACA837438BE> /Users/USER/Library/Developer/CoreSimulator/Devices/97F357C7-0E9C-4388-ADE0-84D37F7A0C25/data/Containers/Bundle/Application/9F4083AA-087E-42AE-B27C-EE6C07B2BA25/
    0x10cc81000 - 0x10ccb4757 +dyld_sim (551.1) <4015E9B7-0BDE-3909-849B-54CB9DB7DDC4> /Applications/
    0x111d85000 - 0x111dcf9df dyld (551.3) /usr/lib/dyld


  • Gmoney494Gmoney494 USMember ✭✭

    @JavierHolcman @LucasTeixeira Hey guys, Ive been trying my own binding with a 3rd party Framework from Adobe. Now i followed Javiers method of extracting the lib/.a from the .frameworks folders and used lipo to create the fat binary. Now that binding project builds and compiles no problem. When i integrate into the test project. It crashes without output in the simulator and device, I have to go to the console logs on the mac to find the logs (exactly like Javiers lastest post above).

    Not sure what else i can do, ive lost a few days on this now. Other details: If i try to bind just the .framework i get other errors in the binding library so i stopped that route. To further frustrate the matter, another developer on my team did the binding to an older version of the same SDK. Now the same test project can ingest and use the older binding no problem, but the new binding project causes issues, same settings.

    Have you guys had any luck to this problem? Thanks again!

  • JavierHolcmanJavierHolcman ARMember ✭✭

    Sorry to hear that, because I had exact the same issue. I couldn't fix it and finally I aborted this project. All the luck to you, and if you found any solution, please let us know.

Sign In or Register to comment.