To better understand ARC I'm looking for example code that compiles perfectly with ARC enabled , but crashes at runtime. Ie the common pitfalls that may be overlooked and can cause you a debugging nightmare if you've never encountered that issue before.
Real life examples tuned down to the minimum code that reproduces the issues would be very helpful. In particular if the ARC code is interfacing with C or C++ code.
Quick example of the many I was thinking along the same lines as bbum.
Casting from CF... to NS... confuses ARC if done incorrectly for example:
CFArrayRef *supportedInterfaces = CNCopySupportedInterfaces();
NSArray *interfaceNames = (__bridge_transfer NSArray *)supportedInterfaces;
CFRelease(supportedInterfaces);
Would over-release supportedInterfaces since __bridge_transfer retains the NSArray while releasing the CFArrayRef. In this case either don't use the CFRelease() or use plain __bridge.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With