SetPage(Xamarin.Forms.Page)'是过时的错误 - Android

Pau*_*aul 4 android xamarin xamarin.forms

我用Xamarin Forms创建了一个通用的应用程序

我收到了警告

Xamarin.Forms.Platform.Android.FormsApplicationActivity.SetPage(Xamarin.Forms.Page)'已过时

有人遇到过这个吗?

代码如下所示

public class MainActivity : AndroidActivity
{
    protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);

        Xamarin.Forms.Forms.Init (this, bundle);    
        SetPage (App.GetMainPage ());
    }
}
Run Code Online (Sandbox Code Playgroud)

保罗

Jas*_*son 7

Forms 1.3.1支持具有MainPage属性的新Application类,它允许您在单个位置(而不是每个平台一次)设置App start页面.

public class App : Application // superclass new in 1.3
{
    public App ()
    {
        // The root page of your application
        MainPage = new ContentPage {...}; // property new in 1.3
    }
Run Code Online (Sandbox Code Playgroud)

我们提供了迁移指南,其中概述了您需要在应用中为新API进行的所有更改.