Singleton Property is always null of the third party framework after doing xamarin ios bindings

59 views Asked by At

I followed the documentation and was successful in building a Xamarin.iOS binding for a third party framework. I used Objective Sharpie to generate my binding code and then made some minor changes to remove verify attributes, add class names etc. My project builds fine.

When I call the singleton instance of this library, it's always null and my app crashes. I tried creating a test project in Swift and used the cocoa pod for this and everything works fine there. There's nothing of significance in the debug output, just that the singleton instance is null.

Any pointers to get this working?

  1. Used @objc for existing swift classes.
  2. Used objective-sharpie tool to generated ApiDefinition and StructsAndEnum, and used these classes along with .framework library of third party framework.
  3. Build the ios binding project and generated DLL.
  4. Singleton shared instance of One of the class is always null.

Below is the generated code from DLL.

[BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] public static NokeDeviceManager Shared { [Export("shared")] get { return Runtime.GetNSObject(Messaging.NativeHandle_objc_msgSend(class_ptr, Selector.GetHandle("shared"))); } }

0

There are 0 answers