Forum Xamarin.iOS

Shell Navigation between Multiple Fly Outs

sisaackssisaacks Member ✭✭✭
edited November 2019 in Xamarin.iOS

I have two fly outs, each has multiple tabs.
When my app loads, it loads on the first tab of my first fly out.
If I navigate to the 2nd fly out, and then back the first fly out, and try to select any items, the app crashes with a null reference exception.
What is weird, this does not happen on Android.

In the App class I originally had
MainPage = new AppShell();

I read somewhere that this would work for ios
MainPage = new NavigationPage(new AppShell());

but this did not work either.

// First Flyout
FlyoutItem Title="Items" Style="{StaticResource BaseStyle}"
Tab Title="Tab One"
ShellContent ContentTemplate="{DataTemplate local:TabOneview}"
Tab
Tab Title="Tab Two"
ShellContent ContentTemplate="{DataTemplate local:TabTwoView}"
Tab
Tab Title="Tab Three" >
ShellContent ContentTemplate="{DataTemplate local:TabThreeView}"
Tab
FlyoutItem

// Second flyout
FlyoutItem Title="Profiles" Style="{StaticResource BaseStyle}"
Tab Title="Alpha"
ShellContent ContentTemplate="{DataTemplate local:AlphaView}"
Tab
Tab Title="Bravo"
ShellContent ContentTemplate="{DataTemplate local:BravoView}"
Tab
Tab Title="Charlie"
ShellContent ContentTemplate="{DataTemplate local:CharlieView}"
Tab
Tab Title="Atmospherics" Icon="SunDarkTheme.png"
ShellContent ContentTemplate="{DataTemplate local:AtmosphericProfileView}"
Tab
FlyoutItem

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    There's no need to wrap the shell with an extra navigation page. Shell has its own navigation.

    and try to select any items, the app crashes with a null reference exception.

    It seems you want to navigate from a list page to a detail page could you please show the code about the navigating?
    Moreover, it's difficult to reproduce your issue through the XAML code you post above. Could you please share a sample so that I can look into it to find out the root cause.

  • sisaackssisaacks Member ✭✭✭

    Below is the error I am getting....I am not entirely sure if its due to syncfusion or not.

    {System.NullReferenceException: Object reference not set to an instance of an object
    at Syncfusion.SfPicker.XForms.iOS.SfPickerRenderer.FormsPicker_SizeChanged (System.Object sender, System.EventArgs e) [0x00000] in :0
    at (wrapper delegate-invoke) .invoke_void_object_EventArgs(object,System.EventArgs)
    at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00029] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1024
    at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:307
    at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:686
    at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:178
    at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:29
    at Syncfusion.XForms.Border.SfBorder.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x000f6] in <4c03acefcda64295b1ec5940f6db2dd0>:0
    at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
    at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
    at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784
    at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1023
    at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:307
    at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:686
    at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:178
    at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00144] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:49
    at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
    at Xamarin.Forms.Layout.OnIsVisibleChanged (System.Boolean oldValue, System.Boolean newValue) [0x00029] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:404
    at Xamarin.Forms.VisualElement+<>c.<.cctor>b__265_4 (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:149
    at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463
    at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:334
    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:311
    at Xamarin.Forms.VisualElement.set_IsVisible (System.Boolean value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:345
    at Syncfusion.XForms.Expander.SfExpander.OnIsExpandedPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0002a] in :0
    at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463
    at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:334
    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:311
    at Syncfusion.XForms.Expander.SfExpander.set_IsExpanded (System.Boolean value) [0x00000] in :0
    at Syncfusion.XForms.iOS.Expander.SfExpander.RaiseExpandingEvent () [0x00024] in <1318ad58c5db4095baa62bf9de2374b2>:0
    at Syncfusion.XForms.iOS.Expander.ExpanderHeader.OnHeaderViewTapped () [0x0005e] in <1318ad58c5db4095baa62bf9de2374b2>:0
    at UIKit.UIGestureRecognizer+ParameterlessDispatch.Activated () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.1.17/src/Xamarin.iOS/UIKit/UIGestureRecognizer.cs:93
    at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.1.17/src/Xamarin.iOS/UIKit/UIApplication.cs:86
    at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.1.17/src/Xamarin.iOS/UIKit/UIApplication.cs:65
    at NightForceMobileApp.iOS.Application.Main (System.String[] args) [0x00001] in }

Sign In or Register to comment.