-(NSString *)description method not called in Cocoa app
-(NSString *)description method not called in Cocoa app
- Subject: -(NSString *)description method not called in Cocoa app
- From: Brian Andresen <email@hidden>
- Date: Sun, 19 Dec 2004 19:09:58 -0800
My project has two targete, a Cocoa app and a command-line-only
testing app. I wrote a custom -description method for my class, but
it's only getting called in the latter one. I haven't yet figured out
the reason.
There's a function which generates an XML file, which is used in both
the testing app and the full app. For each object in a NSArray, it
grabs the -description and appends a new element to the XML file
containing the description. A simplified view of this is:
writeXmlFile()
{
....
NSEnumerator* objEnum = [theArray objectEnumerator];
MyObject* obj;
while ( obj = [objEnum nextObject] )
[xmlStr appendFormat:@" <foo>%@</foo>\n", [obj description]];
....
}
In the CLI app, -[MyObject description] gets called just like I
expect. In the Cocoa app, the same writeXmlFile() function is called,
but now [obj description] returns the NSObject default, like
<MyObject: 0x5c5a20>.
Any ideas on what's different? Why doesn't my method get called in
the Cocoa app? (I put a breakpoint and a NSLog in the -description
method to verify that it was never called.)
Thanks,
-Brian
_______________________________________________
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