-1

I have made a AKSwiftSlideMenu slide out menu bar and when i create a new tap i get an EXC_BAD_INSTRUCTION error in this line of code

if (topViewController.restorationIdentifier! == destViewController.restorationIdentifier!) {

I have tried following the guide multiple times I have been following this guide http://ashishkakkad.com/2015/09/create-your-own-slider-menu-drawer-in-swift/

EddyTheDove
  • 12,979
  • 2
  • 37
  • 45
  • 3
    Possible duplicate of [What does "fatal error: unexpectedly found nil while unwrapping an Optional value" mean?](http://stackoverflow.com/questions/32170456/what-does-fatal-error-unexpectedly-found-nil-while-unwrapping-an-optional-valu) – vadian Mar 11 '17 at 07:38

1 Answers1

0

Agree with Vadian, specifically in this case you have neglected to set the restoration identifier in Storyboard or code for those viewControllers - which the instructions do tell you to do, although not very clearly.

See this tutorial on state restoration for how to do this in Storyboard (go to the section called 'Setting Restoration Identifiers').

But also learn about optionals and how to safely unwrap them - using ! is rarely a good idea.

Ali Beadle
  • 4,486
  • 3
  • 30
  • 55