Re: How to check if super exists if it doesn't without throwing an exception?
Re: How to check if super exists if it doesn't without throwing an exception?
- Subject: Re: How to check if super exists if it doesn't without throwing an exception?
- From: Alex Zavatone <email@hidden>
- Date: Thu, 18 Jun 2015 16:26:29 -0400
On Jun 18, 2015, at 4:13 PM, Jens Alfke wrote:
>
>> On Jun 18, 2015, at 1:06 PM, Alex Zavatone <email@hidden> wrote:
>>
>> I've got some spooky code that I'm digging into that calls an instance method in an uninstantiated timer class
>
> I’m not clear on what that means. If the class doesn’t have any instances, how are you calling an instance method on it?
>
>> Within this pearl, we have [super sendevent:event]; within an @try block.
>> At the point of the exception, super isn't even accessible, declared or defined.
>
> ‘super’ isn’t an object. It’s a language keyword that’s used as the receiver of a method call (message-send). It just means to call the superclass’s implementation of the method, or more literally, “send this message to self but ignore any implementation in self’s class, instead starting lookup in the superclass.”
>
> If [super sendEvent:event] throws an exception, it means that the superclass does not have a -sendEvent: method.
Any reason you can think of why it would intermittently throw an exception?
Self's superclass is UIApplication. The only thing I can think of is that self somehow becomes undefined or changes its superclass.
>
> —Jens
Thanks man.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden