Re: Abstract class with single subclass
Re: Abstract class with single subclass
- Subject: Re: Abstract class with single subclass
- From: Seth Willits <email@hidden>
- Date: Wed, 27 May 2009 14:37:50 -0700
On May 27, 2009, at 2:15 PM, Dave Keck wrote:
Actually, I accidently used [self class] in a class method two
weeks ago,
and it was causing a crash. I forget the circumstances, but when I
caught
that I was using [self class] and changed it to self, everything
worked
fine. So I don't know what the difference is, but there apparently
is a
difference.
That sure sounds strange. +class is plainly defined as a class method
of NSObject. If it's crashing, it sure seems like that'd be a pretty
significant (and probably well-known) bug. The first things that come
to mind that might result in +class crashing are either doing
something fancy with distributed/proxy objects, or perhaps the bundle
that defined the class was unloaded before +class got called.
In "normal" everyday use, [self class] in a class method should never
cause problems, AFAIK.
To clarify, it wasn't calling [self class] that caused the problem,
but rather it crashed later on when using the returned instance. I'm
pretty sure it was during the initial app launch. It'd take quite a
bit of investigation to find it, but it was some wacky crash, the
signature of which I had never seen before.
I know this isn't exactly a very detailed description, but if they
were equivalent, then changing [self class] to self shouldn't have
fixed it, but it did. Pretty weird.
*shrug*
--
Seth Willits
_______________________________________________
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