Im using image in xamarinforms and im binding the source from remote uri, it works in android but when it comes to ios the image is not showing at all. Please someone help me regarding this.
Asked
Active
Viewed 273 times
0
-
Possible duplicate of [Xamarin Forms Images not loading from remote URL](https://stackoverflow.com/questions/47550387/xamarin-forms-images-not-loading-from-remote-url) – GiampaoloGabba May 04 '19 at 09:22
-
yes i have tried this but no use... – Charan Darbasthu May 04 '19 at 09:41
3 Answers
0
Issue is with name convention for android and iOS so please be sure about naming. Try svg for easy use.

SumedhS
- 1
- 2
-
Please [Take the Tour](https://stackoverflow.com/tour) , and be sure to read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). try to give a detailed information about your question. Add your code , what issue your facing? , where your blocking? , what you tried so far? like the way you have to ask your question. – Agilanbu May 04 '19 at 12:46
0
In ios if you are loading images from http then you have to add NSAppTransportSecurity in your info.plist file then it will work.
By default ios load images from secure url(start with https)
you can refer this How do I load an HTTP URL with App Transport Security enabled in iOS 9?

Pragnesh Mistry
- 386
- 5
- 13
0
If you are doing this in Code behind:
ImageSource.FromFile("ImageName.jpg") // from local source,
ImageSource.FromUri(new Uri(url)) // from remote source.
If you are trying to bind from XAML, you can use a converter and return the images;
<ContentView.Resources>
<ResourceDictionary>
<converters:ImageConverter x:Key="ImageConverter" />
</ResourceDictionary>
</ContentView.Resources>
<Image Grid.Row="1" Grid.Column="0" Source="{Binding YourObjectHere, Converter={StaticResource ImageConverter}}" />
In Converter class:
public class ImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value is YourObject xxx)
{
var url = xxx.Images?["small"]; // This is custom code here, you build your url
return string.IsNullOrEmpty(url) ? ImageSource.FromFile("NoImage.jpg") : ImageSource.FromUri(new Uri(url));
}
}
return ImageSource.FromFile("NoImage.jpg");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}

Ali Hus
- 255
- 4
- 10