Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You mainly need to do two things:</p> <ol> <li>Weak-link any frameworks that aren’t present in the 3.2 SDK.</li> <li>Write runtime tests for any APIs that are new to iOS 4.</li> </ol> <p>To do the first, right-click on your target and select “Get Info.” The frameworks are listed in the inspector (under the “General” tab) with a drop-down box next to them that’ll allow you to select “Weak” linking. This ensures that the app will still run if the framework is not present.</p> <p>To do the second, you could do something like the following to test for the new block-based animation in iOS 4:</p> <pre><code>if ([UIView respondsToSelector:@selector(animateWithDuration:animations:)]) { // Your awesome animation code here } else { // Your almost-as-awesome, non-block-based animation code here. } </code></pre> <p>By using introspective methods such as <code>-respondsToSelector:</code>, you can avoid calling something that the currently-running OS doesn’t support.</p> <p>Note also that if you wanted to support iPhone OS 3.0, these same rules would apply.</p> <p>Finally, it's also possible—though not advisable—to do this like so:</p> <pre><code>#ifdef __IPHONE_4_0 // Your iOS 4.0-compatible code here #elif defined(__IPHONE_3_2) // Your iPhone OS 3.2-compatible code here #elif defined(__IPHONE_3_0) // Your iPhone OS 3.0-compatible code here #endif </code></pre> <p>Why is this not advisable? Simple: only the code for the <em>highest</em>-numbered iOS version will be compiled. iPhone apps aren’t compiled separately for separate iOS versions, so to get this to actually <em>work</em>, you would have to release multiple versions of the app.</p>
    singulars
    1. This table or related slice is empty.
    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. 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