Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Exception - the native class hasn't been loaded

$
0
0

I am receiving the following error when trying to run my MonoMac app using a 'wrapped' (bound/linked?) Objective C library.

Could not create an native instance of the type 'MacVolumeCtrl.MacVolumeControl': the native class hasn't been loaded. It is possible to ignore this condition by setting MonoMac.ObjCRuntime.Class.ThrowOnInitFailure to false.

I am using MonoMac which for some reason doesn't have binder projects (unlike IOS) so I have to use bmac.exe, this is the command;

mono bmac.exe bound.cs -r:System.Drawing.dll

This is bound.cs;

` using System; using System.Drawing; using MonoMac.ObjCRuntime; using MonoMac.Foundation;

namespace MacVolumeCtrl 
{

    [BaseType (typeof (NSObject))]
    public partial interface MacVolumeControl {

        [Export ("Cwlog")]
        void Cwlog (string x);

        [Export ("Cwlog")]
        void Cwlog (string x, string result);

        [Export ("Run")]
        int Run { get; }
    }
}`

It compiles just fine and referencing the generated dll works fine as well, until I actually try to create an object of the class. Again, I can't use an IOS binder project so I don't really see how this loads the real objective C lib (is it embedded?) but any threads I find on this issue (like this one) are IOS specific so despite the 6 hours I spent on this already; I don't know what to try next. Hope you can help.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>