I am getting an error in my console:
2009-05-30 20:17:05.801 ChuckFacts[1029:20b] *** -[Joke isEqualToString:]: unrecognized selector sent to insta
By "an array full of jokes", you apparently mean "an array full of classes of type Joke". You can't assign a Joke object to a UILabel's text
property—it takes NSString
only.
(Cocoa isn't like Java or C++, where any object can be coerced to a string automatically through some .toString()
method. Generally the framework asks for NSString
s explicitly when it wants a string.)
Here's what's happening: you're assigning a Joke
object to the text
property. Cocoa allows you to play fast and loose with types like this, without even a warning in this case since it's implicitly understood to be an NSString (the id
type will silently become whatever type you're assigning it to). But when it tries to call isEqualToString:
(an NSString method) on a Joke object, of course it fails.
You need to assign the joke's text to the label instead.
As for how to identify the object: you can issue the po 0x52e2f0
command in the debugger, which usually works if memory isn't completely borked. It'll print an Objective-C representation of the object at that address.