John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 987 forks source link

nil while unwrapping an Optional value #792

Closed maximegheraille closed 6 years ago

maximegheraille commented 6 years ago

hi,

after looking at a lot of people with the same problem I cannot find a solution.

so I can open the menu and click on the "nouveautes" that works fine but the 2 other menu items give me the error : " nil while unwrapping an Optional value"

this is the part where I get the bug:

override func viewDidLoad() {
    super.viewDidLoad()
    if (self.revealViewController() != nil)
    {

        menuButton.target = self.revealViewController()
        menuButton.action = #selector(SWRevealViewController.revealToggle(_:)) //here is the error
        self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())

    }
screenshot 2018-07-05 at 13 07 16
iDevelopper commented 6 years ago

In which view controller are you in your sample code?

Are you sure the crash is exactly on this line?

maximegheraille commented 6 years ago

it's good I found a tutorial on yt and its works fine now :)

for the people having this problem watch this and it will work ! https://www.youtube.com/watch?v=DCbB2cuJzOE&t=777s