| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Jul 30, 2004, at 1:08 PM, Jim Correia wrote:Thanks Greg. That got me to the point that I could debug the problem. A nameless Apple framework (nameless to protect the guilty :-) - I'll file a bug) has a private class which does a poseAsClass: [NSView class] the first time it is used - which happens much after application startup.
Thus demonstrating why using +poseAsClass: is dangerous when instances of the original class may exist. Bad framework, no biscuit.
Yes. This is correct though non-intuitive behavior. The problem is that [NSView class] returns a different result after an impostor poses as NSView.
There are potential ripple effects, but you may or may not run across problems because of them. The problem is that your implementation of -isKindOfClass: is lying; after posing, your old instances really aren't instances of the new NSView class. Some code might be confused because your old instances claim to be NSView but don't act like other NSViews, but such code may be rare.
A second workaround may be to use a custom subclass of NSView for your instances, and never actually instantiate NSView itself. The extra level of subclassing would protect you from any ill effects of posing.
| References: | |
| >Re: What does it mean when po puts % before class name? (From: Greg Parker <email@hidden>) | |
| >Re: What does it mean when po puts % before class name? (From: Jim Correia <email@hidden>) | |
| >Re: What does it mean when po puts % before class name? (From: Greg Parker <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.