Closed mkuprianowicz closed 8 years ago
Hi @misha83, I'm not able to reproduce this problem using the latest build of the library with my iPhone 6S running 9.2. Can you re-run pod install
on your project and give it another try? If it still happens, please give me more details as to how I can recreate this issue.
Also, you don't need to explicitly set SideMenuManager.menuAnimationBackgroundColor = UIColor.clearColor()
as it starts out this way.
Closing until more feedback is provided.
i also had same problem with this line comes to nil. Please give me a solution about that?
Hi @barankaansert. I still cannot reproduce this issue. I'd need more feedback about the problem similar to my request to @misha83 above.
Hi @jonkykong, I want a "Home" item in my menu. So, I created a cell and create a segue from this cell back to the frontView (home view). When I run and click that cell, the above issue happens.
@leizard what exception are you getting? Is this an unwind segue?
I use one side menu for multiple view. So when I'm at a subview, I want to open side menu and click 'Home' item to go back to Home. The issue happen when I'm currently at home view and click to the Home item in side menu. And yes, it is an unwind segue
@leizard what exception are you getting?
I'm sorry for not reading your reply carefully. The exception is the same as the first post. In internal class func hideMenuStart() , SideMenuTransition.viewControllerForPresentedMenu! controller is nil. and it crashes.
I just comment out
SideMenuManager.menuLeftNavigationController = storyboard!.instantiateViewControllerWithIdentifier("LeftMenuNavigationController") as? UISideMenuNavigationController
in my menu init and it doesn't crash anymore
Why does commenting that out in your init solve the problem? It sounds like you're removing the menu entirely because of that. Is the init called again when you return to your home screen?
@leizard I have a theory -- can you verify? My guess is that unwind segues cause the view to be reinitialized, whereas popping/pushing on the stack don't do that. If you're setting up SideMenu in your home view, then any time you unwind to it from the menu, you're replacing the side menu while it's presented, causing this crash.
If instead you initialized SideMenu from your app delegate, or put a simple check in your init that it should only set menuLeftNavigationController
if it was nil, that should resolve the crash.
Let me know what you find.
@leizard i got same issues before ..... you can try change value for SideMenuManager.menuAddScreenEdgePanGesturesToPresent(toView: self.view) to SideMenuManager.menuAddScreenEdgePanGesturesToPresent(toView: leftViewController.view)
hopely it can help ...
Any chance you have a project you can share with me to investigate?
I'm diving into other issues and can't test your suggestion right now. I will response asap when I can. I will also try to create a project containing the issue. Thank you very much for your time and quick replies @jonkykong @fajaradiwa
Hi @jonkykong, I think you are right. I put a check like this
if (SideMenuManager.menuLeftNavigationController == nil) {
SideMenuManager.menuLeftNavigationController = storyboard!.instantiateViewControllerWithIdentifier("LeftMenuNavigationController") as? UISideMenuNavigationController
}
in my frontview controller And everything is fine. So I'm closing this issue. Thank you very much for your support 👍
But I think it is better to detect if it is prepare to segue to the same frontview in prepareForSegue method, so if it is, I just need to close the side menu
@leizard I'm thinking I will fix this by preventing the left or right side menus from being changed while they are actively presented. If this happens, I'll display a warning in the console and ignore the change, preventing the exception. Thoughts?
Hi @jonkykong, sorry for late response. As I understand, each view has to register their side menu. So I want 1 side menu on multiple view, I have to register this side menu multiple times. In other words, I will lose my side menu when I go to another view. Please correct me if I'm wrong. So, when I put a item segue to the presenting front view and click it, the front view will reload again, which it doesn't need to because it is the same view. I think your fix could solve this but I don't it fits in a scenario when we want a side menu on multiple view.
@leizard that is incorrect. The design of SideMenu is such that you can set it up once and reuse it on multiple screens. At most you have to wire up buttons to present the left/right menus or gestures to reveal them, but you don't need to set the left/right menu more than once (unless you want to change them on purpose).
@leizard @fajaradiwa @misha83 @barankaansert I checked in a fix that prevents side menus from being changed while the menu is actively presented, which would cause crashes.
Thank you @jonkykong, I think it would do it.
Application crashes for me after touching home button.In SideMenuTransition.hideMenuStart() SideMenuTransition.viewControllerForPresentedMenu! controller is nil. My init looks like: