Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

oxcug

macrumors newbie
Original poster
Oct 3, 2011
24
0
Hey guys, when I run my program i get this message in the console:
Code:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setText:]: unrecognized selector sent to instance 0x1baef0'
*** First throw call stack:
(0x339c28bf 0x350de1e5 0x339c5acb 0x339c4945 0x3391f680 0x35693 0x34a687ff 0x34a74c39 0x34a74aa9 0x34a7498f 0x34a74211 0x34a73f53 0x34a68673 0x34a68349 0x3391c435 0x34a4a9eb 0x34a4a9a7 0x34a4a985 0x34a4a6f5 0x34a4b02d 0x34a4950f 0x34a48f01 0x34a2f4ed 0x34a2ed2d 0x35559df3 0x33996553 0x339964f5 0x33995343 0x339184dd 0x339183a5 0x35558fcd 0x34a5d743 0x2381 0x2318)
terminate called throwing an exception
And then of course it quits the program. Anybody know how to stop it from quiting?
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
[UIImageView setText:]
TADAAA, if you read the message, it actually says, what you are trying to do, and from reading that, you should know, you have an imageview, and you are trying to set text on it, which it doesn't have as property, so it will crash.
If you fix that, it will run.
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
Stop trying to send setText: to an UIImageView? UIImageView doesn't have a setText method or a text property.

-----
Simultaneous post with jnoxx! LOL.
 

oxcug

macrumors newbie
Original poster
Oct 3, 2011
24
0
Thanks, I'll keep lookin for that

Thanks guys, I actually already saw that and was looking for a "setText" call on a UIImage but couldn't find one (written by me). So I'll keep lookin for it.

THANKS!
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
Thanks guys, I actually already saw that and was looking for a "setText" call on a UIImage but couldn't find one (written by me). So I'll keep lookin for it.

THANKS!

Do you have something like obj.text = @"Blah" somewhere?
 

oxcug

macrumors newbie
Original poster
Oct 3, 2011
24
0
Yeah but they're labels not UIImages. I just went through all my code making sure non of them were accidently images.
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
Yeah but they're labels not UIImages. I just went through all my code making sure non of them were accidently images.

We're not talking about UIImages but UIImageViews.

Are you sure they're UIImageViews? If you log the actual class of your objects what do you get?

You can log the actual class of an object in the variable obj with something like this?
Code:
NSLog(@"obj class = %@", NSStringFromClass([obj class]));
 

oxcug

macrumors newbie
Original poster
Oct 3, 2011
24
0
I think i figured out the problem (please tell me if this would do the trick)

fancyImage is a property.
my Code looks like this (i'm setting the image):
Code:
self.fancyImage.image = [UIImage imageNamed:@"mypic.png"];
BUT it should look like:
Code:
[self.fancyImage setImage:[UIImage imageNamed:@"mypic.png"]];

is that right?
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
They're equivalent. The compiler effectively turns the first into the second. So changing it won't solve your bug.
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
Like Jiminaus said.
synthesizing your property, only generates getters/setters.
The Point notation vs the setObject notation is only a difference between different versions of Objective-C.
So it should result in the same.
Try setting breakpoints, see where your code stops/crashes, and you will know what's wrong. Maybe you are setting labels, but accidently setting the pointer of a label to an UIImageView.
So just debug via breakpoints and head back.
 

oxcug

macrumors newbie
Original poster
Oct 3, 2011
24
0
Alright thanks everyone! I thought the problem was in my code but it was actually in my connections in my .xib/storyboard file. I was connecting a label with a UIImageView. (No clue how that happened):confused:. Anyways thanks to all!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.