0

I got this error after running my app, can anyone tell me what caused it?

2017-07-30 16:42:38.066 MyDiscountApp[1354:264950] *** Terminating app. due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key button.'

Ryan Poolos
  • 18,421
  • 4
  • 65
  • 98
Malik Türk
  • 95
  • 1
  • 9
  • 1
    Welcome to SO! Questions seeking debugging help must include relevant code to be considered on-topic on SO. See [How to create a minimal, complete and verifiable example](https://stackoverflow.com/help/mcve) and include the relevant code in your question. Are you sure you set up both corner radius and clipsToBounds = true for the UIImageView as well and not just for the collection view cell? – Dávid Pásztor Jul 30 '17 at 13:49
  • 1
    @DávidPásztor please edit the above comment , I think you copy pasted it from some other place – 3stud1ant3 Jul 30 '17 at 13:51

2 Answers2

1

In the storyboard/nib file of the ViewController class, you have assigned an object with the name button to the class, but in the ViewController class, you have not defined the button or you may have defined it but then deleted it and forgot to remove the connection from nib/storyboard.

Puneet Sharma
  • 9,369
  • 1
  • 27
  • 33
0

You probably made an Outlet (connection of the button between your Storyboard and ViewController class) and then deleted the outlet in the code.

You also need to delete the connection in Storyboard. See the screenshot below to see how to do it:

Screenshot of Storyboard

Tung Fam
  • 7,899
  • 4
  • 56
  • 63