0

I have a button when clicked it will go to another controller using segue and its called "gosegue" and i'm sending some value with it ..

here is the error i get when i click on the button:

enter image description here

and i have doubled checked the segue..

i tried to remove performsegue and just print something and it worked fine!

can someone please tell me what i am doing wrong?

this what i got:

2018-05-08 09:33:26.776671+0300[4128:1912882] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<.LongtermorderViewController 0x11dc20e80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key familybtn.'

mrs.bassim
  • 469
  • 2
  • 7
  • 16

3 Answers3

1

There is no problem with the segue. You might have created an IBOutlet(familybtn) from LongtermorderViewController from the storyboard, then either removed it or modified it, but still the connection remains in the storyboard. That is why the app is crashing. Revisit all the connections of LongtermorderViewController in your storyboard. You will find '!' besides familybtn connection remove it and then build your application. It should work fine.

Ritu
  • 84
  • 5
0

Please open your "LongtermorderViewController" from storyboard and check IBOutlet of "familybtn".

Vivek
  • 4,916
  • 35
  • 40
0

You can follow this steps for an error free segue.If you are in same a storyBoard then you can simply do this - Take a button in your firstVC and ctrl + drag a segue upto your secondVC. Then click on the segue. (the round thing on between two view controller). -

enter image description here

And set a identifier for that (here about is the identifier, you can give any name for this)-

enter image description here

Here is the code -

@IBAction func UserDetailVC(sender: AnyObject) {
        self.performSegue(withIdentifier: "segueIdentifierName", sender: sender)
    }
Developer Guy
  • 2,318
  • 6
  • 19
  • 37
Rashed
  • 2,349
  • 11
  • 26