Strange error in loading table view

13 views
Skip to first unread message

Lata Rastogi

unread,
Oct 13, 2008, 2:53:16 AM10/13/08
to iphonesdkd...@googlegroups.com
Hi

I am getting a strange error while trying to display a table.

The cellForRowAtIndex is executed properly and then the application crashes. It gives me this error:
*** -[UIButtonContent sizeWithFont:forWidth:lineBreakMode:]: unrecognized selector sent to instance 0x108afd0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIButtonContent sizeWithFont:forWidth:lineBreakMode:]: unrecognized selector sent to instance 0x108afd0'

I am not using any buttons in the view and when I do a "where" in the gdb console, it shows the exception took place in main.m

#0  0x952f9ff4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ ()
#1  0x92436e3b in objc_exception_throw ()
#2  0x95280ad3 in CFRunLoopRunSpecific ()
#3  0x95280cf8 in CFRunLoopRunInMode ()
#4  0x31699d38 in GSEventRunModal ()
#5  0x31699dfd in GSEventRun ()
#6  0x30a5dadb in -[UIApplication _run] ()
#7  0x30a68ce4 in UIApplicationMain ()
#8  0x00002ba4 in main (argc=1, argv=0xbfffee94) at main.m:14

Please help!

Jason Adams

unread,
Oct 13, 2008, 3:05:07 AM10/13/08
to iphonesdkd...@googlegroups.com
I may be wrong but i had a similar problem when i had an imageview as a subview of a cell. I was trying to change the image in the imageview but referencing the wrong subview. are your altering any of the cells subviews?
I believe the UIButton it is referencing is the one associated with the accessory type.
Unrecognized selector means you are trying to have the object do something it can't do or it does not know about.
I am still new and learning so my reply might be totally worthless.

Jason 

iDeveloper

unread,
Oct 13, 2008, 3:14:07 AM10/13/08
to iphonesdkd...@googlegroups.com
Hey.

I am facing a  similar problem.

I am changing the cell subviews but all are labels. Am not creating any buttons as subviews. I do have an accessory type for the cell. But am not creating a custom view for that....
And I have used similar code in many of my views which work without a problem.

Lets see, will stumble upon something stupid I'm doing! :)

Jason Adams

unread,
Oct 13, 2008, 3:20:44 AM10/13/08
to iphonesdkd...@googlegroups.com
when accessing the label subview are you using the subviews array? 
something like..
mylabelsubview = [cell subviews objectatindex:x];

I found it eaiser to use tags to reference the subview.
mylabelsubview = [cell.contenview viewwithtag:VIEW_TAG];

iDeveloper

unread,
Oct 13, 2008, 3:26:10 AM10/13/08
to iphonesdkd...@googlegroups.com
Am using Tags.

Jason Adams

unread,
Oct 13, 2008, 3:30:35 AM10/13/08
to iphonesdkd...@googlegroups.com
can you poet the code that throws the exception?

iDeveloper

unread,
Oct 13, 2008, 3:41:49 AM10/13/08
to iphonesdkd...@googlegroups.com
Never mind, found the problem, albeit a little strange

I had a button on the view (not inside the table) which I had not mapped to any IBOutlet variable but was calling a method on its click.
Strange but as soon as I declared the button and at the end released it, the problem's gone!! :)
Reply all
Reply to author
Forward
0 new messages