Method returns "autoreleased" result?


#1

In Chapter 4 the book says:
[quote]Because you will frequently need objects that you are not retaining, many classes have class methods that return autoreleased objects. NSString, for example, has stringWithFormat:.
[/quote]
In looking at the documentation for “stringWithFormat:” and “initWithFormat:” I don’t see anything about whether what they return is autoreleased. How can I know, from the documentation, whether what is returned is autoreleased or not?

Thanks,
–Don


#2

Check out the first two Retain Count rules on page 76. Objects that are returned from -alloc, -copy, and -mutableCopy have a +1 retain count. All other objects that are returned to you are assumed to have a +1 retain count and are autoreleased.


#3

Thanks Adam! I hadn’t gotten to page 76 yet. I wish the Kindle edition of the book supported page numbers.

–Don