Could not create an native instance IO xamarin Binding

pepeluchepepeluche MXMember ✭✭

I created a binding IOS project , i followed all the steps
https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/walkthrough/

my .a was created, in the IOS project(xamarin forms) i added the binding project as reference
and i can see the methods of epson(i'm trying to print in epson printer using Epson SDK via wifi/bluetooh)
after doing this everything is ok, but when i ran in mac emulator an error is showing (Could not create an native instance IO xamarin Binding)
i have this in the LinkWith.cs file generated automatically when i add the .a file to the binding project

using System;
using ObjCRuntime;
[assembly: LinkWith("libepsonlib.a", LinkTarget.ArmV7 | LinkTarget.Simulator | LinkTarget.Simulator64 | LinkTarget.ArmV7s,
SmartLink = true, ForceLoad = true")]

but i still get this error , anybody can help please?

Posts

  • NashZhouNashZhou USMember ✭✭✭

    Helped fix @pepeluche's problem in a PM.

    If anyone else has the "native class hasn't been loaded" problem, make sure Smart Link and Force Load are true in the properties section of your .a file. The .a file should be located in your Native References folder and you have to right click your file to get to the properties section.

  • pepeluchepepeluche MXMember ✭✭
    edited June 2017

    Thank you NashZhou is now fixed and i can print to epson printer using epson SDK in xamarin!

    also was very important to mention to add -lxml2 in the linker flags properties of the .a file(added to the native references in the IOS project)

Sign In or Register to comment.