What The Problem Is:
At runtime your view controller is going to get deserialized from its XIB/Storyboard. During this process, it's going to read all the objects that are in your IB files and start instantiating them with an NSCoder
. As it is instantiating those objects in your view, it's going to read the IBOutlet
and IBAction
connections in your storyboard and start assigning the hydrated objects to those properties that were connected at design time so that you have programmatic access to them at run time. But here's the kicker: If you have a connection that points to a property that doesn't exist, then this exception will be thrown because it was told a property was there that really isn't.
What's happening is that your Storyboard/XIB is expecting your class to have a property called play
. As your interface shows, you do not have a property called that. I suspect though, that you used to, but renamed it playbtn
.
This is what is meant by
this class is not key value coding-compliant for the key play
It means it tried to do something like this under the covers:
[self setValue:button forKey:@"play"]
For additional enlightenment about Key/Value Coding and serialization, grab a comfy chair and read Key Value Coding Programming Guide and Archives and Serializations Programming Guide
How To Fix It:
In Interface Builder, right click on your view controller and see the list of connections:
See how there is a connection for the property play
and it has a little yellow triangle next to it? This is Interface Builder trying to warn you that you have a connection set there, but the header isn't showing that there is an IBOutlet
of that name.
All you need to do is click that little x
to break the connection to the missing property.
How To Prevent This In The Future
Anytime you change a property in your code, you'll need to make sure that you break any associated connection in Interface Builder.