Debugging "attempt to insert nil value" on customer's machine
Debugging "attempt to insert nil value" on customer's machine
- Subject: Debugging "attempt to insert nil value" on customer's machine
- From: Gideon King <email@hidden>
- Date: Tue, 14 Sep 2004 19:40:54 +1000
Hi all, I have an issue in my program where something is attempting to
insert a nil value into a mutable dictionary, so I get the error:
*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value
One of our customers is having this problem, and I can't reproduce it
here, so can't just break on NSException raise as usual. I need some
way of getting it to print out the key it is attempting to insert a nil
value for, and the contents of the dictionary so that I can track it
down.
Due to the fact that a class cluster is used, I can't do anything with
NSMutableDictionary itself. The concrete class that is identified in
the error is a subclass of NSMutableDictionary called NSCFDictionary.
This is a private class, so I used class dump to get the interface and
subclassed it and used poseAsClass to try to use my own class, which
has its own version of setObject:forKey:
My subclass method never gets called, even if I put the poseAsClass:
before NSApplicationMain(); The exception message does change though
to:
*** -[%NSCFDictionary setObject:forKey:]: attempt to insert nil value
(notice the %) leading me to believe that the runtime system does know
something about the posed class. It therefore appears that there is
something going on behind the scenes here, which I don't understand.
This solution is the one suggested in the archives, but doesn't work
for me, and the person who originally suggested it no longer recalls
how he got it to work.
I would welcome any suggestions of ways to implement something that
will allow me to log the information that will allow me to find and fix
the problem.
TIA
Gideon King
NovaMind Software
www.nova-mind.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden