Apologies for answering my own question (nobody else did)

On 2008-12-13 I posted the following:

Being about to migrate a Cocoa document-based application of mine, which is under development, from Mac OS X 10.4.11 and Xcode 2.5 to Mac OS X 10.5.5 and Xcode 3.1.2 (on a PowerPC G5) the application crashes in the phase of – I think – setting up and displaying the main menu.
<snip>
2008-12-13 12:57:33.701 Blotto[715:813] NSExceptionHandler has recorded the following exception: NSUnknownKeyException -- [<<CIMenuGenerator: 0xa0411d2c> 0x45fdd0> setValue:forUndefinedKey:]: this class is not key value coding- compliant for the key inputBarExtent.
<snip>
objc_exception_throw (in libobjc.A.dylib) + 72
-[NSException init] (in CoreFoundation) + 0
-[CIFilter setValue:forUndefinedKey:] (in QuartzCore) + 200
-[NSObject(NSKeyValueCoding) setValue:forKey:] (in Foundation) + 264
-[CIFilter setValue:forKey:] (in QuartzCore) + 308
ResetMenuBarWindowFilter() (in HIToolbox) + 464
ShowBar(unsigned char, unsigned char) (in HIToolbox) + 312
SetSystemUIMode (in HIToolbox) + 284
-[NSApplication finishLaunching] (in AppKit) + 776
-[NSApplication run] (in AppKit) + 100
NSApplicationMain (in AppKit) + 444
main (in Blotto) (main.m:9)
start (in Blotto) + 68
<snip>
- project format: Xcode 3.1 compatible
- architecture: native
- base SDK: Mac OS X 10.5
- compiler: GCC 4.0
- deployment target: Mac OS X 10.5
- garbage collection: off

In the meantime I created a brand new project, added step by step one part of the previous project after the other, built the application after each addition, started it in the debugger, etc. etc., until the crash appeared again.

The cause of the crash is the following category, I had implemented, overriding a method of NSObject's NSKeyValueCoding category:

@interface NSObject (MyKeyValueCoding)
+ (BOOL)accessInstanceVariablesDirectly;
@end

@implementation NSObject (MyKeyValueCoding)
+ (BOOL)accessInstanceVariablesDirectly { return NO; }
@end

After having deleted this category, the application works again.

Well, there have been warnings on this mailing list about overriding methods of Cocoa categories. I did it at my own risk. Apparently it's too much stopping direct access of instance variables in key-value coding for *each* and *every* class.

Regards
Klaus

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to