Unrecognized selector Obj-C exceptions?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unrecognized selector Obj-C exceptions?

Michael McGlothlin
> Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[Universal_UniversalTableController tableView:willDisplayCell:forRowAtIndexPath:]: unrecognized selector sent to instance 0x7be7f460

I’ve noticed that on subclasses of UITableController, and other iOS types, that I’m seeing errors about unrecognized selectors if I try to call the base method from the subclass method. When I look at the documentation I don’t see anything saying not to use these? It’d be nice if the documentation explicitly said not to use these and/or they raised an exception that was more obvious. If they aren’t to be used it’d be nice if the default value from iOS were noted too - although in that case it seems easier to just return that value from the base methods.
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unrecognized selector Obj-C exceptions?

Michael McGlothlin
I thought I'd seen something about it before and it seems like it used to throw a "don't use this" exception which was much less confusing. I thought maybe that functionality got changed in Unified. I looked in the API docs for all table related stuff and didn't see any notes on the subject.

As overriding is a common thing to do it seems it should be easier to know if doing it is wrong. Mystery exceptions from Obj-C seems bad and I've noticed many of these are difficult to trace back to the cause as they pop out of the main() method.

I've taken to using Debug.WriteLine in pretty much every method I override and even that doesn't always make it clear. Probably there is a better way to debug such issues but I haven't found it yet.


Thanks,
Michael McGlothlin
Sent from my iPhone

> On Feb 20, 2015, at 10:31 AM, Dimitris Tavlikos <[hidden email]> wrote:
>
> Hello Michael,
>
> I'm sure I have seen it somewhere in the documentation, but it was some time ago. Nevertheless, you should not try to call methods that are called by the system anyway. This method is part of UITableViewDelegate, which is a protocol in Objective-C and represented through a class (or interface) in Xamarin.iOS.
>
> Cheers!
>
>>> On 20 Feb 2015, at 6:01 PM, Michael McGlothlin <[hidden email]> wrote:
>>>
>>> Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[Universal_UniversalTableController tableView:willDisplayCell:forRowAtIndexPath:]: unrecognized selector sent to instance 0x7be7f460
>>
>> I’ve noticed that on subclasses of UITableController, and other iOS types, that I’m seeing errors about unrecognized selectors if I try to call the base method from the subclass method. When I look at the documentation I don’t see anything saying not to use these? It’d be nice if the documentation explicitly said not to use these and/or they raised an exception that was more obvious. If they aren’t to be used it’d be nice if the default value from iOS were noted too - although in that case it seems easier to just return that value from the base methods.
>> _______________________________________________
>> MonoTouch mailing list
>> [hidden email]
>> http://lists.ximian.com/mailman/listinfo/monotouch
>
> Dimitris Tavlikos
> Software Developer
> Xamarin MVP
> Author of "iOS Development with Xamarin Cookbook"
> Email: [hidden email]
> Twitter: http://twitter.com/#!/dtavlikos
> Blog: http://software.tavlikos.com
>
>
>
>
>
>
>
>
>
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Loading...