I use SkiaSharp libraries on my Xamarin.Core/Xamarin.iOS project. I try to load an SVG file from the Core library like the following;
var svg = new SKSvg();
Assembly assembly = type.GetTypeInfo().Assembly;
using (Stream stream = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.Images.watermark_light.svg"))
{
svg.Load(stream);
}
The code throws on the "Load" step saying "System.MissingMethodException: Method not found: SkiaSharp.SKTextBlob SkiaSharp.SKTextBlob.CreatePositioned(string,SkiaSharp.SKFont,System.ReadOnlySpan`1<SkiaSharp.SKPoint>)"
My configuration:
- Device: Debug|Simulator
- Linker Behaviour: Don't link
- Xamarin.iOS 15.4.0.0
- xcode13.2: 8fc41ae82
- Rider IDE: RD-221.5591.20
- OS: MacOS Monterey 12.4 (21F79)
Libraries
- SkiaSharp v2.88.1-preview.79
- SkiaSharp.Views v2.88.1-preview.79
- Svg.Skia v0.5.14
- SkiaSharp.Svg v1.60.0
- CoreLibrary/Images/watermark_light.svg(svg path)
I tried to add SKTextBlob reference to LinkerPleaseInclude.cs as well. But, it should not be the case when the linker behaviour is set to "Don't link". Also a added --linkskip argument for the relevant namespace. None of them worked. Any ideas about the issue?
Thanks!
CodePudding user response:
Try updating to version 0.5.16 https://www.nuget.org/packages/Svg.Skia/0.5.16