Xamarin表单图像未从远程URL加载 [英] Xamarin Forms Images not loading from remote URL

查看:99
本文介绍了Xamarin表单图像未从远程URL加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个演示xamarin表单项目,该项目仅显示其图像源设置为远程URL的图像.但是问题是它适用于某些URL,不适用于其他URL.我从Google图片搜索中提取了随机图片链接,并整理了工作列表/非工作列表.对于这种奇怪行为的任何见解都将受到高度赞赏.

I have a demo xamarin forms project that simply displays an image with its image source set to a remote URL. But the problem is it works for some URL and does not for others. I have picked up random image links from google image search and compiled a list of the working / non-working ones. Any insight on this strange behavior is hugely appreciated.

预先感谢!

工作网址

无效网址

http://melangesimsr.com.103-21-58-169.sdin-pp-wb3.webhostbox.net/Assets/UplaodedFiles/20171122090840812.png

https://www.chicagotraveler .com/sites/default/files/concerts-chicago-big-1.jpg

XAML文件

<?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:local="clr-namespace:XamarinImageTest"
             x:Class="XamarinImageTest.MainPage"
             BackgroundColor="#000000">

    <ContentPage.Content>
        <Image Source="https://i.ytimg.com/vi/JTxPzXQ1Sso/maxresdefault.jpg" 
               VerticalOptions="Fill"
               HorizontalOptions="Fill"></Image>
    </ContentPage.Content>
</ContentPage>

推荐答案

为应用程序使用本机http客户端处理程序+ TLS2.0(可以在项目设置中设置):

Use native http client handlers + TLS2.0 for your app (can be set in project settings):

  • https://developer.xamarin.com/guides/android/application_fundamentals/http-stack/
  • https://developer.xamarin.com/guides/cross-platform/macios/http-stack/

对于iOS,还启用http下载:

For iOS also enable http downloads:

这篇关于Xamarin表单图像未从远程URL加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆