Xamarin Forms - iOS Binding - broken?

Nick Sherman 6 Reputation points
2021-05-06T13:52:29.353+00:00

Last year I converted a Native iOS SDK for Epson receipt printers to a static binding library (*.a) to use within our Xamarin Forms suite of apps. It was a little tricky but I eventually got it working. I returned recently to the iOS version of the app to find it was broken, despite nothing having changed in the code or setup.

Essentially, within the iOS-specific code, I can now only see the enums belonging to the SDK namespace, not the classes & methods. I have tried messing around with assembly names, title, namespaces etc, but to no avail. I know that this did work at some stage but something has either changed in VS/XF/my system to cause this. At the moment we are just having to comment out this SDK-specific code while we work on other areas of the app.

I've tried looking for everything I can find on Google and as far as I can see it should be setup correctly - the trickiest part initially was fixing the ApiDefinition.cs file as Objective Sharpie only gets you part of the way.

The repo below contains a brand new Xamarin.Forms project, with just an iOS head and the iOS binding project referenced in the same way as used to work in our production app. If anyone can shed some light on this I would be extremely grateful. If you load the project in VS and look in the AppDelegate file, you should see that the Epos2Printer reference is underlined in red....

https://github.com/1888games/XF_Binding_Test/

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,294 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nick Sherman 6 Reputation points
    2021-05-12T12:34:25.613+00:00

    The solution (or rather workaround...) appears to be to remove the binding project from your solution, and then reference directly to the .dll in the bin folder of the binding project.