LEADTOOLS Support
General
General Questions
Xamarin iOS - RasterSupport.SetLicense throws TypeInitializationException
#1
Posted
:
Thursday, November 8, 2018 5:52:50 AM(UTC)
Groups: Registered
Posts: 23
Thanks: 2 times
Hi,
I have a Xamairn iOS app that's using the Leadtools.Barcode NuGet-package version 20.0.0.3 and when I call either of the RasterSupport.SetLicense(string/stream, string) methods a TypeInitializationException is thrown.
Code:System.TypeInitializationException: The type initializer for 'Leadtools.Internal.Interop.ltkrn' threw an exception.
If I try to create a RasterCodecs instance then I get another TypeInitializationException:
Code:"The type initializer for 'Leadtools.Internal.Interop.ltfil' threw an exception. at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)\n at Leadtools.Codecs.RasterCodecs..ctor ()
#2
Posted
:
Thursday, November 8, 2018 11:42:44 AM(UTC)
Groups: Registered
Posts: 23
Thanks: 2 times
A colleague was observant to the fact that we also had to add the following:
Platform.RuntimePlatform = Platform.IOS;
Leadtools.Core.Assembly.Use();
Leadtools.Svg.Assembly.Use();
RasterSupport.Initialize(this);
Are there any more *.Assembly.Use() that we need to be aware of?
#3
Posted
:
Thursday, November 8, 2018 5:20:20 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 63
Thanks: 2 times
Was thanked: 4 time(s) in 4 post(s)
Mikael,
Those two calls should be the only "*.Assembly.Use()" statements needed to get started with our barcode libraries. Did you get this working after adding the additional lines?
Also, if you haven't downloaded our Main evaluation package, you can download it and take a look at our Barcode Xamarin project contained within. The project should be at the path located below.
"LEADTOOLS 20\Examples\Xamarin\BarcodeDemo"
Joe Zhan
Developer Support Engineer
LEAD Technologies, Inc.
#4
Posted
:
Thursday, November 8, 2018 5:46:28 PM(UTC)
Groups: Registered
Posts: 23
Thanks: 2 times
I don't think I've found the "LEADTOOLS 20" package. I was able to find a "all.zip" (254MB) which looks to contain the same data plus extra? There are several folders and demos, among them a "dotnet-standard\Xamarin\BarcodeDemo"; is that the same demo?
I have an additional question. Since i'm not using Forms but capturing the camera feed using AVFoundation and AVCaptureVideoDataOutputSampleBufferDelegate, I was wondering if there's a "best practice" when it comes to going from the CMSampleBuffer to the RasterImage instances that the BarcodeEngine wants? Currently I'm doing the following steps:
CMSampleBuffer -> CIImage -> CGImage -> UIImage
Then I do the following steps to get a RasterImage from a UIImage:
UIImage -> AsPNG byte array into a MemoryStream -> RasterCodecs.Load(stream) -> RasterImage
I'm asking since I want the data flow to be as efficient as possible since it's a live feed off of the camera. Searching a bit there's a class called RasterImageConverter but I can't seem to find it or the namespace it's supposed to exist in (Leadtools.Converters.RasterImageConverter)?
#5
Posted
:
Friday, November 9, 2018 11:08:40 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 63
Thanks: 2 times
Was thanked: 4 time(s) in 4 post(s)
Mikael,
Yes that should be the same demo if you have the all.zip package. You can obtain the Main evaluation download from the link below and downloading the package labeled "V20 LEADTOOLS Evaluation for Windows".
https://www.leadtools.com/downloads?category=mainAs for best practices, the way you're obtaining the image looks correct. You can obtain the CGBitmapContext and convert that to a CGImage object by using the "ToImage()" method. One you have a CGImage object, you can convert that to a UIImage object by using the "UIImage.FromImage()" call. From there, you're converting the UIImage to RasterImage correctly.
The Leadtools.Converters namespace is only available natively on iOS as frameworks or Android as jars unfortunately. We don't have this library available within our Xamarin libraries at the moment. You can see this from the page linked below.
https://www.leadtools.com/help/leadtools/v20/dh/lc/getting-started.htmlJoe Zhan
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
General
General Questions
Xamarin iOS - RasterSupport.SetLicense throws TypeInitializationException
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.