this document states that, in order to cooperates with codes written in a MRR(manual retain-release) environment, codes written in an ARC environment cannot have a accessor name that begins with “new”, I can’t figure out why ARC puts this restriction on method naming.
this document states that, in order to cooperates with codes written in a MRR(manual
Share
I believe the cause is because of this:
Source: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#family.semantics.init
Method names starting with new by convention used to call both the alloc and init methods in the past and I believe there are still methods used in Apple’s framwork with the ‘new’ convention. I guess ARC still takes this into account with regards to memory management.
Also read up on the following: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#family
I guess the above means you could call a method something like newobject instead of newObject to avoid the mechanisms of ARC, but that might not make much sense for anyone working with your code. Perhaps you could also avoid the usual memory rules by setting an attribute on your custom new* method that forces some other method family on the property.