• 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
Does retain not work on ids?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Does retain not work on ids?


  • Subject: Does retain not work on ids?
  • From: Ken Tozier <email@hidden>
  • Date: Mon, 23 May 2005 21:40:07 -0400

I have a struct in which one field (type = id) serves as a generic "data" object. In my initialization method, i've tried several different ways to retain the field, but when a later method goes to access it, it's always nil. In the past, I've not noticed any difference between sending a message to the id of objects rather than an "official" object.

for example, in a while loop, there's no problem calling the id's method:

NSArray *dict = [NSArray arrayWithObjects:
@"when",
@"pigs",
@"fly",
nil];


NSEnumerator    *enumerator    = [dict objectEnumerator];

NSString          *tempString;

id        tempObj;

while (tempObj = [enumerator NextObject])
{
    tempString = [obj stringByAppendingString: @" uh"];
}

Is "retain" an exception to this rule?

I've also put in NSLogs in the dealloc method for my class to see if i could catch in the act of deallocating bit it never appears in the run log.

Thanks

Ken

_______________________________________________
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: Does retain not work on ids?
      • From: Andy Lee <email@hidden>
    • Re: Does retain not work on ids?
      • From: Pandaa <email@hidden>
  • Prev by Date: Re: Persistent Stores and Packages ...
  • Next by Date: Re: Does retain not work on ids?
  • Previous by thread: NSView needsDisplay in Tiger
  • Next by thread: Re: Does retain not work on ids?
  • Index(es):
    • Date
    • Thread