I'm suddenly having a strange and reproducible error when using an @IBDesignable class, @IBInspectable properties are giving the following warning:
Main.storyboard: warning: IB Designables: Ignoring user defined runtime attribute for key path "test" on instance of "UIButton". Hit an exception when attempting to set its value: [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key test.
To be clear this warning is only a problem in Xcode, it packages fine. Still annoying!
Steps to reproduce
Create a custom @IBDesignable UIButton subclass, with an @IBInspectable String property:
import UIKit
@IBDesignable
class TempButton: UIButton {
@IBInspectable var test:String = ""
}
I've tried several solutions - different variable names, making the 'test' property an Optional, using an initializer, no luck so far.
Here is a screen capture of the problem:
I had a similar issue but I didn't find the solution in the answers above. In my case there was an additional keyPath added by mistake in the Identity inspector:
I face the same problem and I solved it. While you are open the storyboard: 1-click Editor on the upper menu. 2-click on Refresh All Views. 3-restart your application. 4-Build.
I fixed this by ensuring the Interface Builder "build" did not have any errors. Here is what that means:
Note that the issue if probably unrelated to the file you are working in. It appears that if the Interface Builder Build fails before it gets to building the file in question you will see these very cryptic warnings.
(My cause ended up being a Share Extension target referencing an AppIcon and SplashScreen asset catalog incorrectly.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With