Baseflow/Xamarin-Sidebar

App crashes when visiting a BaseController for the second time (when using a storyboard)

kvmerrie opened this issue · 0 comments

Hi,

im using Xamarin-Sidebar for my project in a Storyboard. Everything works fine, except when i'm returning to a BaseController page. The app crashed and gives no feedback in the debugger.

My menu contains 3 buttons that will redirect you to a BaseController page. I will be able to select a page and the selected ViewController is presented. When i change to a different view and then return to a previous visited view the app crashed. Do you have the solution for this issue?

` // DASHBOARD BUTTON
DashboardViewController dashboardViewController = (DashboardViewController)Storyboard.InstantiateViewController("DashboardViewController");

        DashboardButton.TouchUpInside += (o, e) => {
            if (NavController.TopViewController as DashboardViewController == null){
                Console.WriteLine("Redirecting to DashboardViewController");
                NavController.PushViewController(dashboardViewController, false);
            }
            SidebarController.CloseMenu();
        };

        // PROFILE BUTTON
        UserViewController userViewController = (UserViewController)Storyboard.InstantiateViewController("UserViewController");

        ProfileButton.TouchUpInside += (o, e) => {
            if (NavController.TopViewController as UserViewController == null){
                Console.WriteLine("Redirecting to UserViewController");
                NavController.PushViewController(userViewController, false);
            }
            SidebarController.CloseMenu();
        };

        // LESSONS BUTTON
        LessonsViewController lessonsViewController = (LessonsViewController)Storyboard.InstantiateViewController("LessonsViewController");

        LessonsButton.TouchUpInside += (o, e) => {
            if (NavController.TopViewController as LessonsViewController == null){
                Console.WriteLine("Redirecting to LessonsViewController");
                NavController.PushViewController(lessonsViewController, false);
            }
            SidebarController.CloseMenu();
        };`