Information Technology Reference
In-Depth Information
This can be lots of work. It's not unusual to test code on the oldest and newest supported OS, check by inspection
that the code is likely to work on intermediate versions, and hope there are no surprises.
FIGURE 13.2
The most general view of SDK and deployment selection. Code must include tests to check for OS-dependent fea-
tures that may not be available on a user's device. Missing features must be implemented with workarounds and
fallbacks.
Common practical techniques for multi-OS support include the following:
Using variations on the respondsToSelector: method to check whether methods are available
Using NSClassFromString to check whether a class is supported
Reading the supported system version from UIDevice
Including conditional compilation elements to manually select OS-dependent code (This option is typic-
ally used to check for a platform—for example, OS X, the iOS Simulator, or an iOS device—during compil-
ation. Don't use it to manage OS versions.)
TIP
For practical examples of multiple OS support with code, search for Using SDK-Based Development in the docu-
mentation. There's more about conditional compilation later in this chapter.
Setting the deployment target
You can set the deployment target in three ways:
Select the deployment OS with the Deployment Target menu in the Project⇒Info tab, as shown in Figure
13.3.
Select the deployment OS with the Deployment Target menu in the Target⇒Summary tab.
Select the Deployment Target item in the build settings table for either the project or the target.
FIGURE 13.3
Selecting the Deployment Target. This feature appears in three places, but for single-target apps it's easiest to set it
here.
Search WWH ::




Custom Search