###前提・実現したいこと
TabbedPage内に、自分で作成したNavigationPage(以降Navi1)を配置したのですが、アプリ起動直後に例外が発生してしまいます。
Navi1は、Prismのテンプレートで作成したNavigatioPageを継承しただけのページで特に修正はしていません。
また、Navi1を素のNavigationPageに置き換えると例外発生せず正常に表示されました。
なぜ例外が発生するのか教えていただけませんでしょうか。
(ソースコード中のBlankはContentPageを継承しただけの空のページです)
###発生している問題・エラーメッセージ
Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Application windows are expected to have a root view controller at the end of application launch Native stack trace: 0 CoreFoundation 0x000000010cb44d4b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00000001175d121e objc_exception_throw + 48 2 CoreFoundation 0x000000010cb48e42 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000010d72966d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 UIKit 0x000000011041e91d -[UIApplication _runWithMainScene:transitionContext:completion:] + 3827 5 UIKit 0x000000011041b26d -[UIApplication workspaceDidEndTransaction:] + 188 6 FrontBoardServices 0x000000011a3006cb __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24 7 FrontBoardServices 0x000000011a300544 -[FBSSerialQueue _performNext] + 189 8 FrontBoardServices 0x000000011a3008cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45 9 CoreFoundation 0x000000010cae9761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 10 CoreFoundation 0x000000010cace98c __CFRunLoopDoSources0 + 556 11 CoreFoundation 0x000000010cacde76 __CFRunLoopRun + 918 12 CoreFoundation 0x000000010cacd884 CFRunLoopRunSpecific + 420 13 UIKit 0x0000000110419aea -[UIApplication _run] + 434 14 UIKit 0x000000011041fc68 UIApplicationMain + 159 15 ??? 0x0000000130417c9c 0x0 + 5104565404 16 ??? 0x00000001304178dd 0x0 + 5104564445
###該当のソースコード
TabPage.xaml
Xaml
1<?xml version="1.0" encoding="UTF-8"?> 2<TabbedPage 3 xmlns="http://xamarin.com/schemas/2014/forms" 4 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 5 xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms" 6 prism:ViewModelLocator.AutowireViewModel="True" 7 x:Class="test.Views.TabPage" 8 xmlns:v="clr-namespace:test.Views" 9 Title="TabPage" 10 > 11 <ContentPage.Padding> 12 <OnPlatform x:TypeArguments="Thickness" iOS="0,20,0,0" /> 13 </ContentPage.Padding> 14 15 <!-- NG --> 16 <v:Navi1> 17 <x:Arguments> 18 <v:Blank /> 19 </x:Arguments> 20 </v:Navi1> 21 22 <!-- OK --> 23 <NavigationPage> 24 <x:Arguments> 25 <v:Blank /> 26 </x:Arguments> 27 </NavigationPage> 28 29</TabbedPage>
App.xaml.cs
c#
1using Prism.Unity; 2using test.Views; 3using Xamarin.Forms; 4 5namespace test 6{ 7 public partial class App : PrismApplication 8 { 9 public App(IPlatformInitializer initializer = null) : base(initializer) { } 10 11 protected override void OnInitialized() 12 { 13 InitializeComponent(); 14 15 NavigationService.NavigateAsync("TabPage"); 16 } 17 18 protected override void RegisterTypes() 19 { 20 Container.RegisterTypeForNavigation<Blank>(); 21 Container.RegisterTypeForNavigation<NavigationPage>(); 22 Container.RegisterTypeForNavigation<Navi1>(); 23 Container.RegisterTypeForNavigation<TabPage>(); 24 } 25 } 26}
###補足情報(言語/FW/ツール等のバージョンなど)
Xamarin.Forms 2.3.3.193
Prism.Forms 6.2.0
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。