Xamarin iOS example crashes with "Object reference not set to an instance of an object"

J Julius Mueller 1 year 7 months ago
383 0 0

Hello,
I'm trying to create a Xamarin RFID app for Android and iOS.
Before that we had developed two separated native apps for these os.

For the start I create some test apps based on the example apps provided by Zebra.

The Android example works fine for me. I can use it.

But the iOS example doesn't work for me.
I tested the app on two iPhone with iOS 15.5 and 15.6. Both are with the same issue.

I'm using the Xamarin-SDK v1.0.10.0 from
https://www.zebra.com/us/en/support-downloads/software/developer-tools/…

I initialized a RfidSdk-Object.
If I try to get the RfidSdk.ReaderManager or the RfidSdk.Version I got a exception: Object reference not set to an instance of an object.

This is my Main.cs:

public class Application
{
static void Main( string[] args )
{
RfidSdk sdk = new RfidSdk();
Console.WriteLine( sdk.Version ); // This is crashing

UIApplication.Main( args, null, typeof( AppDelegate ) );
}
}

I digged little bit deeper with a Decompiler. In there I saw, that the Version property call the ReaderManager prorperty. If the ReaderManager property is called, the internal API should initialize.

There is a call of srfidSdkFactory.CreateRfidSdkApiInstance wich should return a native API. In my case the call always return NULL.

I tested this line in my Main method:

IsrfidISdkApi api = srfidSdkFactory.CreateRfidSdkApiInstance; // returns NULL

Has anyone a idea how I can fix this issue?

In the Release documentation is written, that the SDK for iOS is up to version 14.x. Maybe is the problem that my iPhones are over version 15? But our native app are running fine on the devices.

Thank you!
Greets,
Julius

CONTACT
Can’t find what you’re looking for?