Failed to set () user defined inspected property on (UIButton)

后端 未结 6 1261
青春惊慌失措
青春惊慌失措 2021-01-17 09:50

In a simple ViewController, I added one UIButton. I would like to use \"User Defined Runtime Attributes\". For now I added the default Bool attribute.

The b

6条回答
  •  醉酒成梦
    2021-01-17 10:24

    Since this thread came up about 5 times in my search for a solution, I wanted to post my fix here for future frustrated souls. The reason I kept getting this error is because Interface Builder doesn't clean up old IBInspectable properties if you're experimenting with them.

    In my case, I started with an Int property called type and set a few custom buttons on my screen to use a value of 3 as a test. Later, I changed it to a more meaningful property name and made it a string, then set a few of those. But when I ran the app, I was getting this message.

    I didn't discover the error until I went to the Identity Inspector and noticed that I still had an old keypath and value in use for some of the buttons:

    Removing the old keypath fixed the problem.

提交回复
热议问题