question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Xamarin.Forms] Problem loading SVG image on iOS

See original GitHub issue

I’m using the latest prerelease available Xamarin.FFImageLoading.Svg.Forms 2.2.10-pre-390 together with Xamarin.Forms 2.3.4.231.

Here is the XAML code used:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:ffimageloadingsvg="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"
    x:Class="App.Views.MainPage">
    <ContentPage.Content>
        <ffimageloadingsvg:SvgCachedImage
                        WidthRequest="200"
                        HeightRequest="200"
                        Source="http://s.cdpn.io/3/kiwi.svg"/>
    </ContentPage.Content>
</ContentPage>

Error:

Xamarin.Forms.Xaml.XamlParseException: Position 13:14. Type ffimageloadingsvg:SvgCachedImage not found in xmlns clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms


To solve the problem here it was necessary to reference the SvgCachedImage assembly in the AppDelegate:

var svgAssembly = typeof(SvgCachedImage).GetTypeInfo().Assembly;
CachedImageRenderer.Init();

The same was not needed on Android. Everything worked as expected.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eusebiucommented, Nov 13, 2017

Created a bug into Xamarin bug tracking system as the Release build is different than the Debug one. https://bugzilla.xamarin.com/show_bug.cgi?id=60653

0reactions
eusebiucommented, Nov 13, 2017

I solved it by adding FFImageLoading.Svg.Forms.SvgCachedImage.Init(); In any case, since “var ignore = typeof(FFImageLoading.Svg.Forms.SvgCachedImage);” was present, I think there is still an issue in the Release build in Xamarin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

svg image is not loading in xamarin
i am trying to load svg image but nothing shows up. I set image to embedded resources and path of image is: enter...
Read more >
How To: SVG as an iOS image asset in Xamarin!
Go to [your Xamarin iOS project] -> Assets.xcassets -> [name of asset].imageset folder and replace your placeholder *.pdf file with *.svg file.
Read more >
Displaying SVGs in Xamarin.Forms - Damir's Corner
It can create an ImageSource from an SVG so that it can be rendered by Image view just like other image formats. I...
Read more >
Support SVG image for Xamarin.Form | by Angel iT - Medium
I have just need to install FFImageLoading library that support load & transform SVG image to UIImage, and then bind it to PhotoBrowser...
Read more >
Cross-Platform Images in Xamarin.Forms Using SVGs
Forms project where almost every image used has been an SVG shared between both the iOS and the Android platform apps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found