简体   繁体   中英

(nonatomic, readwrite, retain) and (nonatomic, strong) in Objective-C ARC

Any difference?

Suppose they are the same as in ARC, retain should be replaced by strong?

So can I say that they are the same?

No, there is no difference. In accordance to my answer here :

  • retain / strong : (automatically retains / releases values on set, makes sure values do not deallocate unexpectedly) (default if ARC and object type)

Also, readwrite is the default for a property, so that isn't necessary, and you are already specifying nonatomic .

strong replaces retain and functions similar. if its an object weak replaces assign(saying reference the object but do not incrment its reference count), nonatomic is the same between the two

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM