System.InvalidOperationException:
在使用之前,您必须调用 Rg.Plugins.Popup.Popup.Init();
我已经将 Rg.Plugins.Popup.Popup.Init() 放入 iOS 的 appdelegate.cs 中,但仍然出现相同的错误,我该怎么办?
System.InvalidOperationException:
在使用之前,您必须调用 Rg.Plugins.Popup.Popup.Init();
我已经将 Rg.Plugins.Popup.Popup.Init() 放入 iOS 的 appdelegate.cs 中,但仍然出现相同的错误,我该怎么办?
简单来说,在启动时需要调用Rg.Plugins.Popup.Popup.Init();
安卓示例
namespace HelloXamarinFormsWorld.Android
{
[Activity(Label = "HelloXamarinFormsWorld", MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// !!!!!! here !!!!!
Rg.Plugins.Popup.Popup.Init(this, bundle);
Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication (new App ());
}
}
}
iOS示例
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
// !!!!!! here !!!!!
Rg.Plugins.Popup.Popup.Init();
global::Xamarin.Forms.Forms.Init ();
LoadApplication (new App ());
return base.FinishedLaunching (app, options);
}
}