• 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
Re: -(NSString *)description method not called in Cocoa app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -(NSString *)description method not called in Cocoa app


  • Subject: Re: -(NSString *)description method not called in Cocoa app
  • From: The Karl Adam <email@hidden>
  • Date: Sun, 19 Dec 2004 23:03:09 -0500

What is your init routine and did you actually implement the
description method? The only way it would print that NSObject default
is if you didn't properly initialize your object, or somewhere in it's
handling you created an NSObject instead of MyObject. In either case
we need more infor to tell you what's wrong.

-Karl


On Sun, 19 Dec 2004 19:09:58 -0800, Brian Andresen
<email@hidden> wrote:
> 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
>
 _______________________________________________
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: Brian Andresen <email@hidden>
References: 
 >-(NSString *)description method not called in Cocoa app (From: Brian Andresen <email@hidden>)

  • Prev by Date: -(NSString *)description method not called in Cocoa app
  • Next by Date: Re: Contextual menu for Text fields/views?
  • Previous by thread: -(NSString *)description method not called in Cocoa app
  • Next by thread: Re: -(NSString *)description method not called in Cocoa app
  • Index(es):
    • Date
    • Thread