Search code examples
xamarinxamarin.iosxamarin-binding

Xamarin Create Binding project for StripeTerminal


I am attempting to create a binding project for the StripeTerminal CocoaPod (Stripe Terminal iOS). I setup the pod file. Then using the Xamarin docs, I installed Objective Sharpie, and used

sharpie pod bind

which created two files. StripeTerminal_ApiDefinitions.cs and StripeTerminal_StructsAndEnums.cs. Those files look good and have the methods I am expecting when I was using a XCode project.

I then pointed added a Native Reference to the StripeTerminal framework file, but it seems a link file was not created. The Xamarin help documentions mention that a iOS Native Library ends in .a, while this framework does not. I tried pointing the native reference to the folder of the framework, to the extensionless library, and even renamed the library project to .a. Each time when I attempt to build it gives me an error of "No API definition file specified".


Solution

  • Your API definition file(s) should have a build action of ObjcBindingApiDefinition:

    <ItemGroup>
        <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
    </ItemGroup>
    

    And your Enum|Structs file(s) should have a build action of ObjcBindingCoreSource:

    <ItemGroup>
        <ObjcBindingCoreSource Include="Structs.cs" />
    </ItemGroup>