Arshad Parwez
Arshad Parwez

Reputation: 1563

Difference between @property(nonatomic, retain)in Xcode 3.2 and @property(strong, nonatomic) in Xcode 4.2

What is the difference between @property(nonatomic, retain) that we used in Xcode 3.2 and @property(strong, nonatomic) which we use in Xcode 4.2 ? What does "strong" mean here?

Upvotes: 1

Views: 6997

Answers (1)

Joachim Isaksson
Joachim Isaksson

Reputation: 180927

"strong" is a hint to ARC (Automatic Reference Counting) that as long as this property points to an object, that object will not be automatically released.

There is also a "weak" keyword, that instead (in IOS5) indicates that ARC is free to release the object the property points to, as long as it sets the property to NULL at the same time.

In summary, as long as an object has at least one "strong" property pointing to it, it won't be released by ARC, when it doesn't it will be released immediately and all "weak" properties pointing to it are set to NULL.

Upvotes: 4

Related Questions