Sidemenu: The app crashes and leads me to a line of code in the SideMenu pod

Created on 24 Apr 2020  路  8Comments  路  Source: jonkykong/SideMenu

My problem is that I log into my app and the side menu works just fine but when I log out of the app and re-login, there is an annoying crash that leads me to a line of code in the pod file. the crash only happens when I log out of the app and re-log again
the issue related to memory management as there is an object the code tries to access and it's not accessible anymore.

Screen Shot 2020-04-24 at 1 53 20 AM

Bug - Help Wanted!

All 8 comments

I've been struggling with this one for a while, I'm assuming you have more than one instance of a side menu in your app?

I've been struggling with this one for a while, I'm assuming you have more than one instance of a side menu in your app?

Yes, I do have more than an instance of the side menu in my app

What I have done to fix this is to move the side menu code into the app delegate and trigger it's display by posting via the NotificationCenter that trigger selectors in the app delegate.

    enum SideMenuPresentationSide {
        case left
        case right
    }
    var sideMenu: SideMenuNavigationController?


    @objc func showDriverMenu() {
        let vc = UIStoryboard(name: "Main", bundle: .main).instantiateViewController(withIdentifier: "DriverMenu")
        showMenu(vc, side: .left)
    }


    private func showMenu(_ vc: UIViewController, side: SideMenuPresentationSide) {
        guard let rootVC = window?.rootViewController else { return }
        sideMenu = SideMenuNavigationController(rootViewController: vc)
        sideMenu!.statusBarEndAlpha = 0
        sideMenu!.menuWidth = rootVC.view.frame.width * 0.75
        sideMenu!.leftSide = side == .left

        rootVC.present(sideMenu!, animated: true, completion: nil)
    }

Make sure if you're setting the rootView controller of the window to dismiss your current instance of SideMenu before doing so!

Thank you so much, you saved many days that might have been wasted if you didn't help me.

Fixed in 6.4.9.

Fixed in 6.4.9.

@jonkykong
Can we get a tag for 6.4.9 so that SPM will pull in this bugfix?

Done.

Was this page helpful?
0 / 5 - 0 ratings