iOS 4.2

This article summarizes the key developer-related features introduced in iOS 4.2. This version of the operating system runs on all iOS-based devices. In addition to describing the key new features, this article lists the documents that describe those features in more detail.

For the latest updates and information, you should also see iOS 4.2 Release Notes. For the complete list of new APIs added in iOS 4.2, see iOS 4.2 API Diffs.


iOS now incorporates support for wireless printing from iPhone and iPad applications. For the most part, the objects provided by UIKit do all of the heavy lifting associated with printing. They manage the printing interfaces, work with your application to render the printable content, and handle the scheduling and execution of print jobs on the printer.

Print jobs submitted by your application are handed off to the printing system, which manages the actual printing process. Print jobs from all applications on a device are queued and printed on a first-come, first-served basis. Users can get the status of print jobs from the Print Center application and can even use that application to cancel print jobs. All other aspects of printing are handled for you automatically by the system.

To simplify the printing process, UIKit provides automatic support for some types of content to make printing easier. Specifically, applications provide printable content in one of three ways:

For information about how to incorporate the new printing support into your applications, see “Printing” in Drawing and Printing Guide for iOS.


AirPlay is a technology that lets your application stream audio to Apple TV and to third-party AirPlay speakers and receivers. AirPlay support is built in to the AV Foundation framework and the Core Audio family of frameworks. Any audio content you play using these frameworks is automatically made eligible for AirPlay distribution. Once the user chooses to play your audio using AirPlay, it is routed automatically by the system.

For information on how to play audio content, see Multimedia Programming Guide.


The Core MIDI framework (CoreMIDI.framework) provides a standard way to communicate with MIDI devices, including hardware keyboards and synthesizers. You use this framework to send and receive MIDI messages and to interact with MIDI peripherals connected to an iOS-based device using the dock connector or network.

For more information about using this framework, see Core MIDI Framework Reference.

Weak Linking Support

Applications that link against iOS SDK 4.2 or later can now take advantage of new support for determining the availability of Objective-C classes. System frameworks now tag their classes with availability information that the compiler can use to link weakly to those classes as needed. This new tagging mechanism simplifies the code you need to use to do runtime checking for the availability of the class. Whereas previously, you needed to use the NSClassFromString function to determine whether a class was present, now you can simply check for the existence the class directly using code similar to the following:

if ([UIPrintInteractionController class])
   // Create an instance of the class and use it.
   // The print interaction controller is not available.

In order to use this feature, you must do the following:

For information about how to perform runtime availability checks for classes and methods, see SDK Compatibility Guide.

Framework Enhancements

The following sections highlight the significant changes to frameworks and technologies in iOS 4.2. For a complete list of all new interfaces available in the system, see iOS 4.2 API Diffs.

Core Location

The Core Location framework includes new interfaces for determining whether a device is authorized to use location services and for detecting changes in the current authorization status. For more information about how to use Core Location in your application, see Location and Maps Programming Guide.

Game Kit

The Game Kit framework includes a new GKFriendRequestComposeViewController class, which you can present from your application and use to invite friends to play a game. For more information about how to use Game Kit in your application, see Game Center Programming Guide.


The iAd framework now supports banner ads sized appropriately for iPad devices. For more information about how to incorporate ads into your applications, see iAd Programming Guide.

Media Player

The Media Player framework includes the following enhancements:

  • The interface presented by the MPVolumeView class now includes a control for routing audio content to AirPlay–enabled devices.

  • The MPMediaItem and MPMediaItemCollection classes now descend from a common ancestor class: MPMediaEntity. This change in hierarchy allows you to create collections that include both items and other collections.

  • Persistent IDs for more collection types are now available.

  • Media queries now provide more information about how media items are grouped together.

For more information about the classes of the Media Player framework, see Media Player Framework Reference.


The UIKit framework includes the following enhancements

For more information about the classes of the UIKit framework, see UIKit Framework Reference.