MainakChoudhury
MainakChoudhury

Reputation: 59

Unsafe_unretain Vs Weak VS Assign

Whats the main difference between these 3 attributes ?? some say Unsafe_Unretain is same as weak but in a non ARC env. And some say Unsafe_unretain is the same as Assign in ARC env ? Whats the actual diff ??

Upvotes: 1

Views: 3926

Answers (1)

Schemetrical
Schemetrical

Reputation: 5536

From here, next time you can search the question up on google.

Assign is identical to weak except that it does not set pointers to deallocated instances to nil, potentially leaving dangling pointers. Assign and unsafe_unretained are identical in usage.

Use unsafe_unretained in iOS 4 or below, or else, use assign. Weak is different than unsafe_unretained and assign.

Upvotes: 3

Related Questions