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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to