• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
-(NSString *)description method not called in Cocoa app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-(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

  • Follow-Ups:
    • Re: -(NSString *)description method not called in Cocoa app
      • From: Chris Giordano <email@hidden>
    • Re: -(NSString *)description method not called in Cocoa app
      • From: The Karl Adam <email@hidden>
  • Prev by Date: Re: Disclosure Triangles
  • Next by Date: Re: -(NSString *)description method not called in Cocoa app
  • Previous by thread: Shared palettes in a document's window controller list
  • Next by thread: Re: -(NSString *)description method not called in Cocoa app
  • Index(es):
    • Date
    • Thread