Re: Catch an exception
Re: Catch an exception
- Subject: Re: Catch an exception
- From: Finlay Dobbie <email@hidden>
- Date: Fri, 4 Nov 2005 15:17:29 +0000
On 04/11/05, malcom <email@hidden> wrote:
> Hello,
> Is possible to capture an exception in method calling?
Yes:
<http://developer.apple.com/documentation/Cocoa/Conceptual/Exceptions/index.html>
> Example:
> I have a class with this method
>
> attachToClass:(id) responderClass;
>
> in another function the class call a method of responderClass. Now I
> would to generate an error event if 'selector is not recognized' (this
> class does not respond to this method).
It might be better to check if the class responds to a given selector
before attempting to call it (see NSObject's respondsToSelector)
rather than trying to handle the exception.
-- Finlay
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden