Your -setObj1:
method is declared as copy
, so it calls -copy
on your Class1
object. -copy
just calls -copyWithZone:nil
. So you either need to implement the NSCopying
protocol (which means implementing -copyWithZone:
), or change your property from copy
to retain
.