Re: Beginner question about strings
Re: Beginner question about strings
- Subject: Re: Beginner question about strings
- From: Shawn Erickson <email@hidden>
- Date: Sun, 04 Jun 2006 15:46:05 -0700
On Jun 4, 2006, at 3:41 PM, D.K. Johnston wrote:
I'm not sure about the status of strings returned by methods like
"substringFromIndex:". I know that they're new strings. But how
long do they last? Are they autoreleased? If an object method
returns one of these strings to another object, should the string
be sent a "retain" message? etc.
Does that method have the word alloc, new, or copy in it? Do the docs
for that method say anything special?
Nope :)
so... the string returned from that method is not "owned" by you and
hence could go away at anytime in the future. If you need it hang
around you need to retain it for as long as you need it (when done
with it you of course need to balance your retain with a release).
-Shawn
_______________________________________________
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