Could not create an native instance of the type

I am referencing iOS binding project in my test app and getting below runtime exception:

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

this is how LinWith.cs look like for iOS binding project-

using ObjCRuntime;
[assembly: LinkWith ("osx_objc.a", LinkTarget.Arm64, LinkerFlags = "-lz", SmartLink = true, ForceLoad = true)]

apidefinitions.cs has the class ACTConfiguration defined as:

// @interface ACTConfiguration : NSObject
[BaseType(typeof(NSObject))]
interface ACTConfiguration
{
    // @property (nonatomic, strong) NSString * _Nullable eventUri;
    [NullAllowed, Export("eventUri", ArgumentSemantic.Strong)]
    string EventUri
    {
        get; set;
    }

    // @property (nonatomic, strong) NSString * _Nullable cacheFilePath;
    [NullAllowed, Export("cacheFilePath", ArgumentSemantic.Strong)]
    string CacheFilePath
    {
        get; set;
    }
}

help is appreciated.

Answers

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    Is this on the device or in the simulator? For the simulator, you need to include x86/x86_64 code in your library.

  • djlldjll NLMember ✭✭

    @DaveHunt said:
    Is this on the device or in the simulator? For the simulator, you need to include x86/x86_64 code in your library.

    Hi Dave, I might have the same problem, what do you mean with 'you need to include x86/x86_64 code in your library.' ?

    Tnx

  • DaveHuntDaveHunt USMember ✭✭✭✭✭
Sign In or Register to comment.