2016-09-17 64 views
1

我想在我们的Xamarin Forms项目中使用FFImageLoading,但我遇到了一些奇怪的问题。Xamarin表单FFImageLoading图像不显示

当我试图把Sources="anyvalidimageurl"在XAML,我得到这个错误:

Invalid XAML: Value cannot be null. Parameter name: 'obj'

这是XAML:

<ffimageloading:CachedImage HorizontalOptions="Center" 
      WidthRequest="300" 
      HeightRequest="300" 
      DownsampleToViewSize="true" 
      Source="http://myimage.com/image.png" 
      x:Name="imgImage"> 
</ffimageloading:CachedImage> 

我试图通过代码来加载图像,但没有图像在iOS上显示。

+0

是您的iOS项目设置为允许HTTP请求? –

+0

NSAppTransportSecurity NSAllowsArbitraryLoads IOS禁用HTTP默认resuqests – Greensy

回答

0

您是否错过了包含CachedImageRenderer.Init();在AppDelegate.cs

2

您需要添加到您的AppDelegate.cs

public override bool FinishedLaunching(UIApplication app, NSDictionary options) 
    { 
     FFImageLoading.Forms.Touch.CachedImageRenderer.Init(); 
     var dummy = new FFImageLoading.Forms.Touch.CachedImageRenderer(); 

     global::Xamarin.Forms.Forms.Init(); 
     LoadApplication(new App()); 

     return base.FinishedLaunching(app, options); 
    } 

欲了解更多信息,请参阅https://github.com/luberda-molinet/FFImageLoading/issues/55