The documentation for sortedArrayUsingDescriptors say that it returns a copy of the receiving array.
What does this mean with regards to the returned object's retain count?
Do I need to release it?
"Copy" here means an array with its contained pointers copied. It's a different array from the one receiving that message, so its retain count is entirely different from the original. It's also autoreleased as the method name doesn't contain any of the words "new", "copy", "retain", "alloc" or "init".
You don't need to care whether the array you get from -sortedArrayUsingDescriptors: is autoreleased or not. What matters is whether you have copied, retained, or allocated it. If not, then don't release it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With