0

我正在使用ffimageloading开发 Xamarin UWP 应用程序。这些图像在我通过 Visual Studio 运行的 Windows Phone 模拟器上显示得很好,但是当我通过设备门户将它部署到设备时,所有图像都丢失了。

 <ffimageloading:CachedImage Grid.Column="0" Grid.Row="1" 
    Source="{helpers:ImageResource MyProject.Assets.Images.music-doublenote.png}" />
4

4 回答 4

2

问题是构建配置。通过关闭主 UWP 应用的发布配置的属性的构建选项卡上的“使用 .NET 本机工具链编译”并使用 WinAppDeployCmd.exe 部署应用程序

于 2016-05-20T17:20:14.130 回答
0

要使“使用 .NET Native 工具链编译”工作,您必须使用 UWP 特定的 Forms.Init 调用重载,它允许正确包含 FFImageLoading 程序集以供 Xamarin.Forms 使用:

// you'll need to add `using System.Reflection;`
List<Assembly> assembliesToInclude = new List<Assembly>();

//Now, add in all the assemblies your app uses
assembliesToInclude.Add(typeof (FFImageLoadingAssembliesHere).GetTypeInfo().Assembly);

//Also do this for all your other 3rd party libraries

Xamarin.Forms.Forms.Init(e, assembliesToInclude);
// replaces Xamarin.Forms.Forms.Init(e);
于 2016-08-12T04:07:46.367 回答
0

每当我将图像文件保存在任何文件夹中(例如,assets)时,我都会遇到同样的问题。但后来我开始将图像文件保存在主项目文件夹中;我没有将它们保存在任何文件夹中,它们开始出现在应用程序中。

于 2016-05-20T06:30:12.933 回答
0

我的 UWP 应用程序上也没有显示图像的问题。这些图像显示在我的 Android 项目上,但没有显示在 UWP 上。对我来说,解决方案是添加文件扩展名。出于某种原因,“myimage”适用于 Android 但不适用于 UWP,必须包含“myimage.png”之类的文件扩展名。只是想把这个留给其他可能遇到同样问题的人。

于 2020-05-17T04:57:05.527 回答