views:

55

answers:

2

Is the product item a copy, or just a reference to the object in the NSArray? Does it need to be released? Considering there is no alloc, I assume there is no need for release, correct?

ProductItem *item = [appDelegate.productTextList objectAtIndex:[indexPath row]];

A: 

It's just a pointer of type ProductItem, so it's not a copy.

Your reference is guaranteed to be valid in the scope of the call to objectAtIndex (it calls autorelease on the object). If you want to keep it around for longer you need to retain and are responsible to release it when you are done with it.

Johannes Rudolph
+1  A: 

It is a pointer to the ProductItem class.

You should only release an object if you have done something to increase it's retain count. I.e. alloc/init, copy, or call retain.

MarkPowell