Q nsstring The specific differences between copy and retain in the attribute declarationcopy is the source object release and then the new object copy is paid to the source object
retain is to release the source objectafter the new object retain again to the source object
The fundamental difference is that when the object makes a deep copy, copy wants to open up new storage space, and the effect is the same when the shallow copy. The reference count facet retain is the source object reference count plus 1,copy when
is shallow copy when the source object reference count plus 1, deep copy when the source object reference count is not changed, new object reference count plus 1.
nsstring *str = @ "Hello";
Copy of copy original mode
nsmutablestring *STRM = [str copy];
[StrM appendstring:@ "123"]; it is not working because copy is copied just as it is, and the memory address is the same. Can't think of a different type pointing at him, he's this thing.
Deep copy: To change
Shallow copy: Unchanged
OC syntax--Ask the specific difference between copy and retain in the NSString attribute declaration