![](/img/trans.png)
[英]How to handle exception thrown from Controller's Initialize method?
[英]Cannot initialize FFImageLoading, exception thrown
我正在尝试在跨平台的xamarin应用程序中使用FFImageLoading。
我按照说明进行操作,并在android和IOS项目中都安装了Xamarin.FFImageLoading和Xamarin.FFImageLoading.Forms。
然后,我使用以下代码初始化库:
[Activity (Label = "app", Icon = "@drawable/icon", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate (Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate (bundle);
CachedImageRenderer.Init();
global::Xamarin.Forms.Forms.Init (this, bundle);
global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, bundle);
LoadApplication (new TheWillowEffect.App ());
}
}
我还没有尝试过IOS。 不是优先事项。
我有以下XAML,只是看它是否有效:
<ContentPage
....xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"....>
....
<ffimageloading:CachedImage HorizontalOptions="Center" VerticalOptions="Center"
WidthRequest="300" HeightRequest="300"
DownsampleToViewSize="true"
Source = "http://loremflickr.com/600/600/nature?filename=simple.jpg"
Grid.Column="1"
Grid.Row="1">
当我运行它时,我得到:
System.MissingMethodException: method 'FFImageLoading.Forms.Droid.CachedImageRenderer.init()' not found.
不知道发生了什么。 我怀疑智能感知会陷入一个缺少using
,并且在编译过程没有错误,上面只有一个,在运行时。
我做错了什么!
只需清理项目并重建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.