Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p><strong>If I decide to upgrade to iOS 5, do I need to remove all [myObject retain] and [myObject release] statements from my code?</strong></p> </blockquote> <p>Yes, but XCode 4.2 includes a new "Migrate to Objective-C ARC" tool (in the Edit->Refactor menu), which does that for you. Calling dealloc is a different story. As mentioned in the comments the clang reference states that you should keep your the dealloc method:</p> <p><em>Rationale: even though ARC destroys instance variables automatically, there are still legitimate reasons to write a dealloc method, such as freeing non-retainable resources. Failing to call [super dealloc] in such a method is nearly always a bug.</em></p> <blockquote> <p>You enable ARC using a new -fobjc-arc compiler flag. ARC is supported in Xcode 4.2 for Mac OS X v10.6 and v10.7 (64-bit applications) and for iOS 4 and iOS 5. (Weak references are not supported in Mac OS X v10.6 and iOS 4). There is no ARC support in Xcode 4.1. </p> </blockquote> <p>-</p> <blockquote> <p><strong>If I develop a new app for iOS 5 using ARC, will I need to implement some sort of "retro-compatibility" checks? I.e.: will I need to check the version of iOS and call retain and release accordingly? So, basically, is ARC available for all iOS versions or just for iOS 5?</strong></p> </blockquote> <p>No, because ARC does its magic on compile time and not on run time.</p> <blockquote> <p>Instead of you having to remember when to use retain, release, and autorelease, ARC evaluates the lifetime requirements of your objects and automatically inserts the appropriate method calls for you at compile time. The compiler also generates appropriate dealloc methods for you.</p> </blockquote> <p>Further Information on ARC: <a href="http://clang.llvm.org/docs/AutomaticReferenceCounting.html">http://clang.llvm.org/docs/AutomaticReferenceCounting.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload