You either have ARC on or off for a particular file. If its on you cannot use retain
release
autorelease
etc… Instead you use strong
weak
for properties or __strong
__weak
for local variables (defaults to __strong
). Strong is the equivalent to retain, however ARC will manage the release for you.
The only time you would want to use weak, is if you wanted to avoid retain cycles (e.g. the parent retains the child and the child retains the parent so neither is ever released).
The ‘toll free bridging’ part (casting from NS
to CF
) is a massive headache by the looks of things. You still have to manually manage CFRelease()
and CFRetain()
for CF objects. When you convert them back to NS objects you have to tell the compiler about the retain count so it know what you have done.
http://stackoverflow.com/questions/7912555/weak-and-strong-property-setter-attributes-in-objective-c