Search code examples
xcodensunknownkeyexception

class is not key value coding-compliant for a nonexistent IBAction


I have created as swift project in Xcode, and i added Button to the storyboard. The IBAction of that button is named "WhenButtonPresed", but when I run the App it gets crashed and i got the below posted error despite i do not have any IBAction called "sd"

code:

2017-06-19 08:46:21.909 Test_SWIFT_FMDB-1[958:18819] 
<CATransformLayer: 0x7fc353d2e1d0> - changing property 
contentsGravity in transform-only layer, will have no effect
2017-06-19 08:46:22.188 Test_SWIFT_FMDB-1[958:18819] *** Terminating 
app due to uncaught exception 'NSUnknownKeyException', reason:   
'[<Test_SWIFT_FMDB_1.ViewController 0x7fc353d25fa0> 
setValue:forUndefinedKey:]: this class is not key value coding-
compliant for the key sd.'

*** First throw call stack:


Solution

  • I have found this error a couple of times and it seems to be a configuration on the UI that is not correct. It seems to happen when I copy a viewcontroller which has certain links to current objects which I used on the original viewcontroller...

    How I correct it:

    1. I select the ViewController in question

    enter image description here

    1. I check for exclamation marks and remove it

    enter image description here

    Hope this helps