I am working on a ARC based project. My project is targeted IOS 4.3. Since there is no weak pointer for the version < IOS 5.0, I have to use unsafe_unretained
which may cause dangling pointers.
Now I am thinking, is it really, good option to use ARC with unsafe_unretained? Or should I switch back to manual memory management since my project is targeted IOS 4.3.?
If it is a good option to use ARC in my case, where should I set the unsafe_unretained properties to nil? I have seen people doing it in viewDidUnload, but viewDidUnload is never called in normal scenario. Any help is greatly appreciated.
Is it really a good option to use ARC [without support for weak]?
Yes. ARC is commonly considered a big advantage in code brevity, readability and reduces the number of memory related bugs. My personal opinion is that this is the main benefit of ARC.
Support for weak is nice and another advantage of ARC (on iOS 5). But sometimes __weak
can hide bugs that would pop up immediately with __unsafe_unretained
.
In my code whenever I use weak
properties or variables I have to think about the consequences. The rest of ARC's memory management on the other hand requires me to think less (which is nice).