2016-07-20 34 views
2

我使用Xamarin.Forms MasterDetailPage和ContentPage與Navigataion。 當應用程序開始時我打電話LoginPageXamarin表單更改主頁ios錯誤

Application.Current.MainPage = new NavigationPage(new LoginInPage()); 

然後登錄是成功,我叫MasterDetailPage

App.Current.MainPage = new RootPage(); 
await Navigation.PopToRootAsync(); 

在Android中所有的工作都是很好的,但在iPhone模擬器有錯誤

未處理異常: System.NullReferenceException:未將對象引用設置爲對象的實例

在Main.cs

iOS上

UIApplication.Main(args, null, "AppDelegate"); 

回答

0

這是工作。

if (Device.OS == TargetPlatform.Android) 
        Application.Current.MainPage = new Source.Pages.MenuPage(); 
       else if (Device.OS == TargetPlatform.iOS) 
        await Navigation.PushModalAsync(new Source.Pages.MenuPage());