By default, the copyWithZone: method copy behavior with the provided SDK objects is a shallow copy. This means that if you call the copyWithZone: on NSString object, it will create a shallow copy, but not a deep copy. The difference between shallow and deep copy:
A shallow copy of an object copies links only to objects in the original array and places them in a new array.
A deep copy will actually copy the individual objects contained in the object. This is accomplished by sending each individual object in a copyWithZone: message in your custom class method.
INSHORT: To get a shallow copy, you call retain or strong for all instance variables. To get a deep copy, you call copyWithZone: for all instance variables in the custom class implementation copyWithZone: Now it is your choice.
Trident Apr 15 '15 at 15:06 2015-04-15 15:06
source share