很抱歉,如果以前有人问过这个问题。
我有一个非常简单的问题,我想知道我是否缺少明显的东西。在我的实践Xamarin.Forms应用程序中,即使通过浏览器到达以下图像源URI,也无法加载http://lorempixel.com/1920/1080/sports/7/:没事。
在我看来,Xamarin需要扩展图像才能正常工作,例如,如果我要在线上某种图像,如{https://www.stickpng.com/assets/images/58b061138a4b5bbbc8492951.png,警告,如果该链接可以下载猫图像,您可以查看),然后加载正常。
我的问题有两个:我是否缺少我需要启用的简单配置(这是针对Android的,因为我没有可用的atm的iOS设备),并且B:xamarin甚至支持相对路径吗?
后面的代码:
var source = new UriImageSource
{
Uri = new Uri("http://lorempixel.com/1920/1080/sports/7/")
};
source.CachingEnabled = false;
ImageOne.Source = source;
答案 0 :(得分:2)
iOS和Android现在都需要https
:
Apple will require HTTPS connections for iOS apps by the end of 2016
“今天,我很自豪地说,到2016年底,App Transport Security已成为App Store应用程序的必要条件,”苹果公司安全工程和体系结构负责人Ivan Krstic在WWDC演讲中说道。
Android P Will Default to HTTPS Connections for All Apps
[Android P]默认会默认阻止应用中的HTTP流量
应该容易解决-将http
更改为https
:
var source = new UriImageSource
{
Uri = new Uri("https://lorempixel.com/1920/1080/sports/7/")
};
source.CachingEnabled = false;
ImageOne.Source = source;