Re: stringWithFormat
Re: stringWithFormat
- Subject: Re: stringWithFormat
- From: "Kyle Sluder" <email@hidden>
- Date: Tue, 21 Oct 2008 22:09:34 -0400
On Mon, Oct 20, 2008 at 3:25 AM, Ron Green <email@hidden> wrote:
> stringWithFormat: returns an NSString that is autoreleased. I know this
> because I read it in Hillegasses book. But since this does not seem to be
> covered in the documentation, if I had not read it in a book, how would I
> discover that the NSString was autoreleased?
Actually, the documentation usually isn't explicit about whether an
object is autoreleased. The Cocoa Memory Management documentation
specifies the rules you must follow (if you create something, release
it; if you don't create it, you must retain it if you want to hold
onto it, and you must release it later), but that doesn't mean that a
method will necessarily return an autoreleased object. In most cases,
it will, but it may return a singleton, for example. Or some crazy
self-memory-managing thing.
Just follow the rules and you'll be fine.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden