whatsnewiniphoneos

40
What's New in iPhone OS General 2010-06-04

Upload: logictest2011

Post on 28-Jun-2015

173 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: WhatsNewIniPhoneOS

What's New in iPhone OSGeneral

2010-06-04

Page 2: WhatsNewIniPhoneOS

Apple Inc.© 2010 Apple Inc.All rights reserved.

No part of this publication may be reproduced,stored in a retrieval system, or transmitted, inany form or by any means, mechanical,electronic, photocopying, recording, orotherwise, without prior written permission ofApple Inc., with the following exceptions: Anyperson is hereby authorized to storedocumentation on a single computer forpersonal use only and to print copies ofdocumentation for personal use provided thatthe documentation contains Apple’s copyrightnotice.

The Apple logo is a trademark of Apple Inc.

Use of the “keyboard” Apple logo(Option-Shift-K) for commercial purposeswithout the prior written consent of Apple mayconstitute trademark infringement and unfaircompetition in violation of federal and statelaws.

No licenses, express or implied, are grantedwith respect to any of the technology describedin this document. Apple retains all intellectualproperty rights associated with the technologydescribed in this document. This document isintended to assist application developers todevelop applications only for Apple-labeledcomputers.

Every effort has been made to ensure that theinformation in this document is accurate. Appleis not responsible for typographical errors.

Apple Inc.1 Infinite LoopCupertino, CA 95014408-996-1010

App Store is a service mark of Apple Inc.

iTunes Store is a registered service mark ofApple Inc.

Apple, the Apple logo, Bonjour, Instruments,iPhone, iPod, iPod touch, iTunes, iWork,Keychain, Mac, Mac OS, Macintosh, Objective-C,Quartz, Safari, and Xcode are trademarks ofApple Inc., registered in the United States andother countries.

iPad is a trademark of Apple Inc.

Intel and Intel Core are registered trademarksof Intel Corportation or its subsidiaries in theUnited States and other countries.

Java and all Java-based trademarks aretrademarks or registered trademarks of SunMicrosystems, Inc. in the U.S. and othercountries.

OpenGL is a registered trademark of SiliconGraphics, Inc.

Simultaneously published in the United Statesand Canada.

Even though Apple has reviewed this document,APPLE MAKES NO WARRANTY OR REPRESENTATION,EITHER EXPRESS OR IMPLIED, WITH RESPECT TOTHIS DOCUMENT, ITS QUALITY, ACCURACY,MERCHANTABILITY, OR FITNESS FOR A PARTICULARPURPOSE. AS A RESULT, THIS DOCUMENT ISPROVIDED “AS IS,” AND YOU, THE READER, AREASSUMING THE ENTIRE RISK AS TO ITS QUALITYAND ACCURACY.

IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT,INDIRECT, SPECIAL, INCIDENTAL, ORCONSEQUENTIAL DAMAGES RESULTING FROM ANYDEFECT OR INACCURACY IN THIS DOCUMENT, evenif advised of the possibility of such damages.

THE WARRANTY AND REMEDIES SET FORTH ABOVEARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORALOR WRITTEN, EXPRESS OR IMPLIED. No Appledealer, agent, or employee is authorized to makeany modification, extension, or addition to thiswarranty.

Some states do not allow the exclusion or limitationof implied warranties or liability for incidental orconsequential damages, so the above limitation orexclusion may not apply to you. This warranty givesyou specific legal rights, and you may also haveother rights which vary from state to state.

Page 3: WhatsNewIniPhoneOS

Contents

Introduction 7

Organization of This Document 7Getting the iPhone SDK 7

iPhone OS 4.0 9

Multitasking 9Integration Technologies 10

Local Notifications 10Event Kit 10Core Motion 10Data Protection 11Core Telephony 11iAd 11

Graphics and Multimedia 11High-Resolution Screen Support 11Quick Look Framework 12AV Foundation 12Assets Library 13Image I/O 13Core Media 13Core Video 13

Core Services 13Block Objects 13Grand Central Dispatch 14Accelerate Framework 14

Xcode Tools 14Xcode Improvements 14UI Automation API 15

Framework Enhancements 15UIKit Framework Enhancements 15Foundation Framework Enhancements 16OpenGL ES Enhancements 17Game Kit Enhancements 17Core Location Enhancements 17Map Kit Enhancements 18Message UI Enhancements 18Core Graphics Enhancements 18ICU Enhancements 19

Inherited Improvements 19

32010-06-04 | © 2010 Apple Inc. All Rights Reserved.

Page 4: WhatsNewIniPhoneOS

iPhone OS 3.2 21

User Interface Changes 21Popovers 21Split Views 21Custom Input Views 22External Display Support 22Gesture Recognizers 22

Improved Text Support 23Core Text 23Text Input Support 23Custom Font Support 24ICU Regular-Expression Support 24

File and Document Support 24File-Sharing Support 24Document Support 25PDF Generation 25

Xcode Tools 25API Changes 26

UIKit Framework Changes 26Media Player Framework Changes 27Core Animation Changes 27MapKit Framework Changes 27Foundation Framework Changes 27

iPhone OS 3.1 29

Video Editing Support 29Core Animation Enhancements 29Instruments 29

iPhone OS 3.0 31

Apple Push Notification Service 31Cut, Copy, and Paste 31Accessory Support 32In App Purchase Support 32Peer to Peer Support 32Maps API 33iPod Library Access 33Audio Recording and Management 33Core Data 34In App Email 34Streaming Video 34Safari Features 35Shared Keychain Items 35

42010-06-04 | © 2010 Apple Inc. All Rights Reserved.

Page 5: WhatsNewIniPhoneOS

Accessibility Support 35Compass Support 36OpenGL ES 2.0 36Additional Enhancements 36

UIKit Framework Enhancements 36Foundation Framework Enhancements 37Core Audio Enhancements 37

API Changes 38

Document Revision History 39

52010-06-04 | © 2010 Apple Inc. All Rights Reserved.

Page 6: WhatsNewIniPhoneOS

62010-06-04 | © 2010 Apple Inc. All Rights Reserved.

Page 7: WhatsNewIniPhoneOS

Important: This is a preliminary document for an API or technology in development. Although this documenthas been reviewed for technical accuracy, it is not final. Apple is supplying this information to help you planfor the adoption of the technologies and programming interfaces described herein. This information is subjectto change, and software implemented according to this document should be tested with final operatingsystem software and final documentation. Newer versions of this document may be provided with futureseeds of the API or technology.

This document provides information about features that were introduced in different versions of iPhone OSand that affect the development of iPhone applications. This document describes only features that affectthe development of iPhone applications. It does not include user-level features unless there is an aspect ofthe feature that affects application development.

In addition to describing the new features for each iPhone OS release, this document attempts to provideinsight as to how and when you might use those features in your own software. Wherever possible, thisdocument also provides links to other Apple conceptual and reference documentation for that feature. Fora complete list of features you can use in your iPhone applications, see iPhone OS Technology Overview.

Organization of This Document

This document includes the following articles:

■ “iPhone OS 4.0” (page 9) describes the new and updated features in iPhone OS 4.0.

■ “iPhone OS 3.2” (page 21) describes the new and updated features in iPhone OS 3.2.

■ “iPhone OS 3.1” (page 29) describes the new and updated features in iPhone OS 3.1.

■ “iPhone OS 3.0” (page 31) describes the new and updated features in iPhone OS 3.0.

Getting the iPhone SDK

Development of iPhone applications requires an Intel-based Macintosh computer running Mac OS X v10.5or later. You must also download and install the iPhone SDK. For information about how to get the iPhoneSDK, go to http://developer.apple.com/iphone/.

Organization of This Document 72010-06-04 | © 2010 Apple Inc. All Rights Reserved.

Introduction

Page 8: WhatsNewIniPhoneOS

8 Getting the iPhone SDK2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

Introduction

Page 9: WhatsNewIniPhoneOS

This article summarizes the developer-related features introduced in iPhone OS 4.0. This version of theoperating system runs on iPhone and iPod touch only and does not run on iPad. In addition to describingthe new features, this article lists the documents that describe those features in more detail.

Note: iPhone OS 4.0 does not support iPad. It runs only on iPhone and iPod touch devices.

For the latest updates and information, you should also see iPhone OS 4.0 Release Notes. For the list of APIdifferences between the iPhone OS 4.0 and earlier versions of iPhone OS, see iPhone OS 4.0 API Diffs.

Multitasking

Applications built using iPhone SDK 4.0 or later (and running in iPhone OS 4.0 and later) are no longerterminated when the user presses the Home button; instead, they now shift to a background executioncontext. For many applications, this means that the application enters a suspended state of execution shortlyafter entering the background. Keeping the application in memory avoids the subsequent launch cycle andallows an application to simply reactivate itself, which improves the overall user experience. And suspendingthe application improves overall system performance by minimizing power usage and giving more executiontime to the foreground application.

Although most applications are suspended shortly after moving to the background, applications that needto continue working in the background may do so using one of the following techniques:

■ An application can request a finite amount of time to complete some important task.

■ An application can declare itself as supporting specific services that require regular background executiontime.

■ An application can use local notifications to generate user alerts at designated times, whether or notthe application is running.

Regardless of whether your application is suspended or continues running in the background, supportingmultitasking does require some additional work on your part. Background applications can still be terminatedunder certain conditions (such as during low-memory conditions), and so applications must be ready to exitat any time. This means that many of the tasks you used to perform at quit time must now be performedwhen your application moves to the background. This requires implementing some new methods in yourapplication delegate to respond to application state transitions.

For more information on how to handle the new background state transitions, and for information on howto continue running in the background, see iPhone Application Programming Guide.

Multitasking 92010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 10: WhatsNewIniPhoneOS

Integration Technologies

The following sections describe the technologies you can use to enhance your application’s user experience.

Local Notifications

Local notifications complement the existing push notifications by giving applications an avenue for generatingthe notifications locally instead of relying on an external server. Background applications can use localnotifications as a way to get a user’s attention when important events happen. For example, a navigationapplication running in the background can use local notifications to alert the user when it is time to make aturn. Applications can also schedule the delivery of local notifications for a future date and time and havethose notifications delivered even if the application is not running.

The advantage of local notifications is that they are independent of your application. Once a notification isscheduled, the system manages the delivery of it. Your application does not even have to be running whenthe notification is delivered.

For more information about using local notifications, see Local and Push Notification Programming Guide.

Event Kit

The Event Kit framework (EventKit.framework) provides an interface for accessing calendar events on auser’s device. You can use this framework to get existing events and add new events to the user’s calendar.Calendar events can include alarms that you can configure with rules for when they should be delivered. Inaddition to using Event Kit for creating new events, you can use the view controllers of the Event Kit UIframework (EventKitUI.framework) to present standard system interfaces for viewing and editing events.

For more information about the classes and methods of these frameworks, see Event Kit Framework Referenceand Event Kit UI Framework Reference.

Core Motion

The Core Motion framework (CoreMotion.framework) provides a single set of interfaces for accessing allmotion-based data available on a device. The framework supports accessing both raw and processedaccelerometer data using a new set of block-based interfaces. For devices with a built-in gyroscope, you canretrieve the raw gyro data as well as processed data reflecting the attitude and rotation rates of the device.You can use both the accelerometer and gyro-based data for games or other applications that use motionas input or as a way to enhance the overall user experience.

For more information about the classes and methods of this framework, see “Motion Events” in EventHandlingGuide for iPhone OS.

10 Integration Technologies2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 11: WhatsNewIniPhoneOS

Data Protection

Applications that work with sensitive user data can now take advantage of the built-in encryption availableon some devices to protect that data. When your application designates a particular file as protected, thesystem stores that file on-disk in an encrypted format. While the device is locked, the contents of the file areinaccessible to both your application and to any potential intruders. However, when the device is unlockedby the user, a decryption key is created to allow your application to access the file.

Implementing data protection requires you to be considerate in how you create and manage the data youwant to protect. Applications must themselves be designed to secure the data at creation time and to beprepared for changes in access to that data when the user locks and unlocks the device.

For more information about how to add data protection to the files of your application, see “ImplementingStandard Application Behaviors” in iPhone Application Programming Guide.

Core Telephony

The Core Telephony framework (CoreTelephony.framework) provides interfaces for interacting withphone-based information on devices that have a cellular radio. Applications can use this framework to getinformation about a user’s cellular service provider. Applications interested in cellular call events can also benotified when those events occur.

For more information about using the classes and methods of this framework, see Core Telephony FrameworkReference.

iAd

You can use iAd (iAd.framework) to deliver banner-based advertisements from your application.Advertisements are incorporated into standard views that you integrate into your user interface and presentwhen you want. The views themselves work with Apple’s ad service to automatically handle all the workassociated with loading and presenting the ad content and responding to taps in those ads.

For more information about using iAd in your applications, see iAd Framework Reference.

Graphics and Multimedia

The following sections describe the new graphics and media-related technologies you can incorporate intoyour applications.

High-Resolution Screen Support

For the most part, applications running on devices with high-resolution screens should work with little orno modifications. The coordinate values you specify during drawing or when manipulating views are allmapped to a logical coordinate system, which is decoupled from the underlying screen resolution. Anycontent you draw is automatically scaled as needed to support high-resolution screens. For vector-based

Graphics and Multimedia 112010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 12: WhatsNewIniPhoneOS

drawing code, the system frameworks automatically use any extra pixels to improve the crispness of yourcontent. And if you use images in your application, UIKit provides support for loading high-resolution variantsof your existing images automatically.

For detailed information about how to support high-resolution screens, see “Supporting High-ResolutionScreens” in iPhone Application Programming Guide.

Quick Look Framework

The Quick Look framework (QuickLook.framework) provides a direct interface for previewing the contentsof files your application does not support directly. This framework is intended primarily for applications thatdownload files from the network or that otherwise work with files from unknown sources. After obtainingthe file, you use the view controller provided by this framework to display the contents of that file directlyin your user interface.

For more information about the classes and methods of this framework, see Quick Look Framework Reference.

AV Foundation

The AV Foundation framework (AVFoundation.framework) is for applications that need to go beyond themusic and movie playback features found in the Media Player framework. Originally introduced in iPhoneOS 3.0, this framework has been expanded in iPhone OS 4.0 to include significant new capabilities, substantiallybroadening its usage beyond basic audio playback and recording capabilities. Specifically, this frameworknow includes support for the following features:

■ Media asset management

■ Media editing

■ Movie capture

■ Movie playback

■ Track management

■ Metadata management for media items

■ Stereophonic panning

■ Precise synchronization between sounds

■ An Objective-C interface for determining details about sound files, such as the data format, sample rate,and number of channels

The AV Foundation framework is a single source for recording and playing back audio and video in iPhoneOS. This framework also provides much more sophisticated support for handling and managing media items.

For more information about the classes and methods of the AV Foundation framework, see AV FoundationFramework Reference.

12 Graphics and Multimedia2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 13: WhatsNewIniPhoneOS

Assets Library

The Assets Library framework (AssetsLibrary.framework) provides a query-based interface for retrievinga user’s photos and videos. Using this framework, you can access the same assets that are nominally managedby the Photos application, including items in the user’s saved photos album and any photos and videos thatwere imported onto the device. You can also save new photos and videos back to the user’s saved photosalbum.

For more information about the classes and methods of this framework, see Assets Library FrameworkReference.

Image I/O

The Image I/O framework (ImageIO.framework) provides interfaces for importing and exporting imagedata and image metadata. This framework is built on top of the Core Graphics data types and functions andsupports all of the standard image types available in iPhone OS.

For more information about the functions and data types of this framework, see Image I/OReferenceCollection.

Core Media

The Core Media framework (CoreMedia.framework) provides the low-level media types used by AVFoundation. Most applications should never need to use this framework, but it is provided for those fewdevelopers who need more precise control over the creation and presentation of audio and video content.

For more information about the functions and data types of this framework, see Core Media FrameworkReference.

Core Video

The Core Video framework (CoreVideo.framework) provides buffer and buffer pool support for Core Media.Most applications should never need to use this framework directly.

Core Services

The following sections describe the new lower-level technologies and features you can incorporate into yourapplications.

Block Objects

Block objects are a C-level language construct that you can incorporate into your C, C++, and Objective-Ccode. A block object is a mechanism for creating an ad hoc function body, something which in other languagesis sometimes called a closure or lambda. You use block objects in places where you need to create a reusablesegment of code but where creating a function or method might be too heavyweight or inflexible.

Core Services 132010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 14: WhatsNewIniPhoneOS

In iPhone OS, blocks are commonly used in the following scenarios:

■ As a replacement for delegates and delegate methods

■ As a replacement for callback functions

■ To implement completion handlers for one-time operations

■ To facilitate performing a task on all the items in a collection

■ Together with dispatch queues, to perform asynchronous tasks

For an introduction to block objects and how you use them, see A Short Practical Guide to Blocks. For moreinformation about blocks, see Blocks Programming Topics.

Grand Central Dispatch

Grand Central Dispatch (GCD) is a BSD-level technology that you use to manage the execution of tasks inyour application. GCD combines an asynchronous programming model with a highly optimized core toprovide a convenient (and more efficient) alternative to threading. GCD also provides convenient alternativesfor many types of low-level tasks, such as reading and writing file descriptors, implementing timers, monitoringsignals and process events, and more.

For more information about how to use GCD in your applications, see Concurrency Programming Guide. Forinformation about specific GCD functions, see Grand Central Dispatch (GCD) Reference.

Accelerate Framework

The Accelerate framework (Accelerate.framework) contains interfaces for performing math, big-number,and DSP calculations, among others. The advantage of using this framework over writing your own versionsof these libraries is that it is optimized for the different hardware configurations present in iPhone OS–baseddevices. Therefore, you can write your code once and be assured that it runs efficiently on all devices.

For more information about the functions of the Accelerate framework, see Accelerate Framework Reference.

Xcode Tools

The following sections describe the improvements to the Xcode tools and the support for developing iPhoneOS applications.

Xcode Improvements

Xcode 3.2.3 introduces automatic device and provisioning-profile management in the Organizer window.With automatic device provisioning enabled, you can install applications on your device for debugging andtesting without having to log in to your team portal to register the device and download a provisioningprofile

14 Xcode Tools2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 15: WhatsNewIniPhoneOS

Note: You still need to log in to your team portal to create provisioning profiles with specific application IDsfor in-app purchase and push notifications. However, once created, those provisioning profiles will also bemanaged by Xcode if automatic device provisioning is enabled.

For more information about using Xcode, see iPhone Development Guide.

UI Automation API

The Instruments application now provides support for automating the testing of your iPhone OS applications.The built-in Automation instrument works from scripts (written in JavaScript) that you provide to drive thesimulation of events in your application. These synthetic events are generated with the help of the accessibilityinterfaces built into iPhone OS and integrated into all existing UIKit views. You can use this instrument toimprove your testing process and deliver more robust applications.

For information about how to use the Automation instrument, see Instruments User Guide. For informationabout the JavaScript objects and commands you use in your scripts, see UI Automation Reference Collection.

Framework Enhancements

The following existing frameworks and technologies include additional incremental changes. For a completelist of new interfaces, see iPhone OS 4.0 API Diffs.

UIKit Framework Enhancements

The UIKit framework includes the following enhancements:

■ The UIApplication class and UIApplicationDelegate protocol include new methods for schedulinglocal notifications and for supporting multitasking.

■ Drawing to a graphics context in UIKit is now thread-safe. Specifically:

❏ The routines used to access and manipulate the graphics context can now correctly handle contextsresiding on different threads.

❏ String and image drawing is now thread-safe.

❏ Using color and font objects in multiple threads is now safe to do.

■ The UIImagePickerController class includes methods for programmatically starting and stoppingvideo capture. It also includes options for selecting which camera you want to use on a device and forenabling a built-in flash.

■ The UILocalNotification class supports the configuration of local notifications; see “LocalNotifications” (page 10).

■ The UIView class includes new block-based methods for implementing animations.

■ The UIWindow class has a new rootViewController property that you can use to change the contentsof the window.

Framework Enhancements 152010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 16: WhatsNewIniPhoneOS

■ Media applications can now receive events related to the controls on an attached set of headphones.You can use these events to control the playback of media-related items.

■ Several new accessibility interfaces help you make some UI elements more accessible and allow you tocustomize your application experience specifically for VoiceOver users:

❏ The UIAccessibilityAction protocol makes it easy for VoiceOver users to adjust the value ofUI elements, such as pickers and sliders.

❏ UIPickerViewAccessibilityDelegate protocol enables access to the individual componentsof a picker.

❏ UIAccessibilityFocus protocol allows you to find out when VoiceOver is focused on an element,so you can help users avoid making unnecessary taps.

❏ The UIAccessibilityTraitStartsMediaSession trait allows you to prevent VoiceOver fromspeaking during a media session that should not be interrupted.

❏ New interfaces in UIAccessibility protocol allow you to specify the language in which labelsand hints are spoken, and provide announcements that describe events that don't update applicationUI in way that would be perceptible to VoiceOver users.

■ The UINib class provides a way to instantiate multiple sets of objects efficiently from the same nib file.

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

Foundation Framework Enhancements

The Foundation framework includes the following enhancements:

■ Most delegate methods are now declared in formal protocols instead of as categories on NSObject.

■ Block-based variants are now available for many types of operations.

■ There is new support for creating and formatting date information in NSDate and NSDateFormatter.

■ The NSDateComponents class added support for specifying time zone and quarter information.

■ There is support for regular-expression matching using the NSRegularExpression, NSDataDetector,and NSTextCheckingResult classes.

■ The NSBlockOperation class allows you to add blocks to operation queues.

■ You can use the NSFileManager class to mark files as protected; see “Data Protection” (page 11).

■ The NSFileWrapper class allows you to work with package-based document types.

■ The NSOrthography class describes the linguistic content of a piece of text.

■ The NSCache class provides support for storing and managing temporary data.

■ The URL-related classes have been updated so that you can now pipeline URL requests and set requestpriorities.

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

16 Framework Enhancements2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 17: WhatsNewIniPhoneOS

OpenGL ES Enhancements

The OpenGL ES framework includes the following enhancements:

■ The APPLE_framebuffer_multisample extension enables full-scene anti-aliasing.

■ The EXT_framebuffer_discard extension can be used to improve the performance of applicationsthat use depth buffers or multisample framebuffers.

■ The APPLE_texture_max_level and EXT_shader_texture_lod extensions provide more controlover texture sampling.

■ TheOES_vertex_array_object (http://www.khronos.org/registry/gles/extensions/OES/OES_vertex_ar-ray_object.txt) API allows caching of vertex array state, to decrease driver overhead.

■ The OES_depth_texture extension enables rendering real-time shadows using shadow maps.

■ The OES_texture_float (http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt)and OES_texture_half_float (http://www.khronos.org/registry/gles/extensions/OES/OES_tex-ture_float.txt) extensions adds texture formats with floating point components to enable High DynamicRange rendering.

■ The APPLE_rgb_422 (http://www.opengl.org/registry/specs/APPLE/rgb_422.txt) extension enablestexturing from some common video formats.

■ Performance of texture creation and modification has been significantly improved.

■ Driver performance has been generally improved.

Game Kit Enhancements

The Game Kit framework includes a beta implementation of a centralized service called Game Center. Thisservice provides game developers with a standard way to implement the following features:

■ Aliases allow users to create their own online persona. Users log in to Game Center and interact withother players anonymously through their alias. Players can set status messages as well as mark specificpeople as their friends.

■ Leader boards allow your application to post scores to Game Center and retrieve them later.

■ Matchmaking allows players to connect with other players with Game Center accounts.

Important: GameCenter is available to developers only in iPhoneOS 4.0. It is introduced as a developer-onlyfeature so that you can provide feedback as you implement and test Game Center features in your applications.However, Game Center is not a user feature in iPhone OS 4.0 and you should not deploy applications thatuse it to the App Store.

For information about the classes of the Game Kit framework, see Game Kit Framework Reference.

Core Location Enhancements

The Core Location framework now supports the following features:

Framework Enhancements 172010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 18: WhatsNewIniPhoneOS

■ A location monitoring service that tracks significant changes using only cellular information. This solutionoffers a lower-power alternative for determining the user’s location.

■ The ability to define arbitrary regions and detect boundary crossings into or out of those regions. Thisfeature can be used for proximity detection regardless of whether the application is running.

For information about the classes of the Core Location framework, see Core Location Framework Reference.

Map Kit Enhancements

The Map Kit framework includes the following enhancements:

■ Support for draggable map annotations

■ Support for map overlays

Draggable map annotations make it much easier to reposition those annotations after they have been addedto a map. The Map Kit framework handles most of the touch events associated with initiating, tracking, andending a drag operation. However, the annotation view must work in conjunction with the map view delegateto ensure that dragging of the annotation view is supported.

Map overlays provide a way to create more complex types of annotations. Instead of being pinned to a singlepoint, an overlay can represent a path or shape that spans a wider region. You can use overlays to layerinformation such as bus routes, election maps, park boundaries, and weather maps on top of the map.

For information about the functions and types of the Map Kit framework, see Map Kit Framework Reference.

Message UI Enhancements

The Message UI framework includes a new MFMessageComposeViewController class for composing SMSmessages. This class manages a standard system interface for composing and sending SMS messages. Incontrast with sending SMS messages using a specially formatted URL, this class allows you to create andsend the message entirely from within your application.

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

Core Graphics Enhancements

The Core Graphics framework includes the following enhancements:

■ The ability to embed metadata into PDF files using the CGPDFContextAddDocumentMetadata function

■ Support for creating color spaces using an ICC profile

■ Graphics context support for font smoothing and fine-grained pixel manipulation

For information about the functions and types of the Core Graphics framework, see Core Graphics FrameworkReference.

18 Framework Enhancements2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 19: WhatsNewIniPhoneOS

ICU Enhancements

The International Components for Unicode (ICU) libraries were updated to version 4.4. ICU is an open-sourceproject for Unicode support and software internationalization. The installed version of ICU includes only asubset of the header files that are part of the broader ICU library. Specifically, iPhone OS includes only theheaders used to support regular expressions.

For more information about using the functions of the ICU 4.4 library, see the documentation at http://site.icu-project.org/.

Inherited Improvements

Although iPhone OS 3.2 does not run on iPhone and iPod touch devices, many of the features introduced inthat version of the operating system are also supported in iPhone OS 4.0. Specifically, iPhone OS 4.0 supports:

■ Custom input views

■ Connecting external displays

■ File-sharing support

■ Gesture recognizers

■ Core Text for text layout and rendering

■ Text input through integration with the keyboard

■ Custom fonts

■ ICU Regular Expressions

■ Document types

■ PDF generation

■ Xcode Tools changes

■ UIKit framework changes

■ Media Player framework changes

■ Core Animation changes

■ Foundation framework changes

What is not supported are new controls and classes designed specifically for iPad. For more informationabout these features, see their descriptions in “iPhone OS 3.2” (page 21).

Inherited Improvements 192010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 20: WhatsNewIniPhoneOS

20 Inherited Improvements2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 4.0

Page 21: WhatsNewIniPhoneOS

This article summarizes the developer-related features introduced in iPhone OS 3.2. This version of theoperating system runs on iPad only and many of the corresponding features were designed specifically forthat device. In addition to describing the features, this article lists the documents that describe those featuresin more detail.

Note: iPhone OS 3.2 does not support iPhone and iPod touch devices. It runs only on iPad.

For the latest updates and information, you should also see iPhone SDK Release Notes for iPhone OS 3.2. Forthe list of differences between iPhone OS 3.2 and earlier versions of iPhone OS, see iPhone OS 3.2 API Diffs.

User Interface Changes

Applications running on iPad have several new options for presenting content and receiving input from theuser. For information and guidelines about how to use these new features, be sure to consult iPad HumanInterface Guidelines.

Popovers

Popovers are floating views that reside above your application’s window and help you organize the contentsof your user interface. Popovers help to eliminate the clutter that might occur in applications that need todisplay important controls or information in an unobtrusive way that does not distract from the main content.

The benefit of using a popover is that:

■ It appears only in response to specific user interactions and is dismissed automatically when the usertaps outside of its bounds. This behavior makes the popover less obtrusive to the user.

■ It typically covers only a small portion of the screen and so does not obscure as much of the underlyingcontent as a modal view might.

For more information about using popovers in your application, see “Views and View Controllers” in iPadProgramming Guide.

Split Views

The UISplitViewController class is a new container view controller that you use to manage twoside-by-side content views. These content views are typically used to create a master-detail interface, wherebyselecting an item in one view causes the other view to display detailed information about the selection. Theviews themselves are managed by view controllers that you provide.

User Interface Changes 212010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.2

Page 22: WhatsNewIniPhoneOS

The split view controller coordinates any interactions between your view controllers and the system. Forexample, when the user rotates the device, the split view controller rotates both view controllers together,forwarding any needed notifications to both of them.

For more information about split views, including how to use them in your applications, see “Views and ViewControllers” in iPad Programming Guide.

Custom Input Views

Instances of the UIResponder class now support the ability to display custom input and accessory viewswhen they become the first responder. Now, you can provide input views for any of your custom views andhave them presented automatically by the system. (Previously, the keyboard was the only supported inputview, and it was supported only by text view and text field objects.)

In addition to input views, you can also provide a custom accessory view to display above the input view.Accessory views are commonly used to provide additional buttons and controls when the keyboard isdisplayed. The explicit support now provided by responder objects makes it easy to animate your accessoryviews into position.

For more information about how to configure and use custom input and accessory views, see “Custom TextProcessing and Input” in iPad Programming Guide and the UIResponder Class Reference.

External Display Support

An iPad can be connected to an external display through a set of supported cables. When connected, theassociated screen can be used by the application to display content. Information about the screen, includingits supported resolutions, is accessible through the interfaces of the UIKit framework. You also use thatframework to associate your application’s windows with one screen or another.

■ The UIScreen class provides support for retrieving screen objects for all available screens (includingthe device’s main screen). Each screen object contains information about the properties of the screenitself, including the dimensions that correctly take into account the size and pixel aspect ratio of thescreen.

■ The UIScreenMode class provides information about one particular size and pixel aspect ratio settingof a screen.

■ Windows (represented by the UIWindow class) can now be assigned to a specific screen.

For more information about the support offered by these classes, see the individual class descriptions in UIKitFramework Reference.

Gesture Recognizers

Gesture recognizers are objects that you attach to views and use to detect common types of gestures. Afterattaching it to your view, you tell it what action you want performed when the gesture occurs. The gesturerecognizer object then tracks the raw events and applies the system-defined heuristics for what the givengesture should be. Prior to gesture recognizers, the process for detecting a gesture involved tracking theraw stream of touch events coming to your view and applying potentially complicated heuristics to determinewhether the events represented the given gesture.

22 User Interface Changes2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.2

Page 23: WhatsNewIniPhoneOS

UIKit now includes a UIGestureRecognizer class that defines the basic behavior for all gesture recognizers.You can define your own custom gesture recognizer subclasses or use one of the system-supplied subclassesto handle any of the following standard gestures:

■ Tapping (any number of taps)

■ Pinching in and out (for zooming)

■ Panning or dragging

■ Swiping (in any direction)

■ Rotating (fingers moving in opposite directions)

■ Long presses

For more information about using gesture recognizers in your application, see “Gesture Recognizers” in iPadProgramming Guide.

Improved Text Support

In iPhone OS 3.2, there is significant new support for text input and rendering. This support is provided forapplications, such as word processors, that need more sophisticated text-handling capabilities.

Core Text

The Core Text framework (CoreText.framework) contains a set of simple, high-performance C-basedinterfaces for laying out text and handling fonts. The Core Text framework provides a complete text layoutengine that you can use to manage the placement of text on the screen. The text you manage can also bestyled with different fonts and rendering attributes.

This framework is intended for use by applications that require sophisticated text handling capabilities, suchas word processing applications. If your application requires only simple text input and display, you shouldcontinue to use the existing classes of the UIKit framework.

For more information about using the Core Text interfaces, see Core Text Programming Guide and Core TextReference Collection.

Text Input Support

The UIKit framework (UIKit.framework) includes new protocols that allow you to implement customtext-input objects. If you are implementing an application that requires sophisticated text-handling capabilities,you can use these protocols to implement new views and controls for receiving incoming text. Dependingon your needs, there are different protocols for receiving text input. Which protocols you use will dependon the complexity of your user interface.

■ The UIKeyInput protocol lets you define simple objects (like text fields) that are capable ofcharacter-by-character input.

■ The UITextInput protocol lets you define complex text views that support multiple lines of text,selections, pasteboard operations, and more.

Improved Text Support 232010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.2

Page 24: WhatsNewIniPhoneOS

For more information about how to use the text input support to implement your own custom objects, see“Custom Text Processing and Input” in iPad Programming Guide.

Custom Font Support

Applications that want to use custom fonts can now include those fonts in their application bundle andregister those fonts with the system by including the UIAppFonts key in their Info.plist file. The valueof this key is an array of strings identifying the font files in the application’s bundle. When the system seesthe key, it loads the specified fonts and makes them available to the application.

For more information about the keys you can include in your application’s Info.plist file, see InformationProperty List Key Reference.

ICU Regular-Expression Support

The BSD layer of iPhone OS now exposes a modified version of 4.2 of the International Components forUnicode (ICU) libraries. ICU is an open-source project for Unicode support and software internationalization.The installed version of ICU includes only those header files necessary to support regular expressions.

For more information about using the functions of the ICU 4.2 library, see the documentation and user guideat http://icu-project.org/apiref/icu4c/index.html.

File and Document Support

In iPhone OS 3.2, there is new support for exchanging and opening files. This support makes it easier toimplement more document-centric applications, similar to what you might find on a desktop computer,while still maintaining a simplified interface for your users.

File-Sharing Support

Applications that want to make user data files accessible can do so using application file sharing. File sharingenables the application to expose the contents of its /Documents directory to the user through iTunes. Theuser can then move files back and forth between the iPad and a desktop computer. This feature does notallow your application to share files with other applications on the same device, though. To share data andfiles between applications, you must use the pasteboard or a document interaction controller object.

To enable file sharing for your application, do the following:

1. Add the UIFileSharingEnabled key to your application’s Info.plist file and set the value of thekey to YES.

2. Put whatever files you want to share in your application’s Documents directory.

3. When the device is plugged into the user’s computer, iTunes 9.1 displays a File Sharing section in theApps tab of the selected device.

4. The user can add files to this directory or move files to the desktop.

24 File and Document Support2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.2

Page 25: WhatsNewIniPhoneOS

Applications that support file sharing should be able to recognize when files have been added to theDocuments directory and respond appropriately. For example, your application might make the contents ofany new files available from its interface. You should never present the user with the list of files in this directoryand ask them to decide what to do with those files.

For additional information about the UIFileSharingEnabled key, see InformationProperty List KeyReference.

Document Support

An application can now register the file types it supports with the system and receive notifications when afile of the given type needs to be opened. It does this by including the CFBundleDocumentTypes key in itsInfo.plist file. An application that registers one or more file types may also be expected to open files of thosetypes at some point later. It does this by implementing theapplication:didFinishLaunchingWithOptions:method in its application delegate and look for a filein the UIApplicationLaunchOptionsURLKey key of the provided dictionary.

Complementing the ability to open files of known types is the addition of theUIDocumentInteractionController class in the UIKit framework. This class provides a user-basedinteraction model for managing files that your application does not know how to open. The documentinteraction controller provides options for previewing the contents of a file in place or opening it in anotherapplication. Document interaction controllers are particularly useful for email applications or applicationsthat may download files from the network.

For more information about supporting documents, see “The Core Application Design” in iPad ProgrammingGuide.

PDF Generation

The UIKit framework (UIKit.framework) includes new functions for generating PDF files and data objectsfrom your application’s custom content. You can use this support to generate PDF-based content for usewithin your application or for storing to the local disk. The UIKit functions manage the setup and paginationfor the PDF data. You provide the actual content using the same native platform graphics technologies (UIKit,Core Graphics, Core Text, and so on) already available for drawing to the screen. (You cannot draw to a PDFcontext directly using OpenGL commands. However, you can transfer the pixels of your rendered contentto a CGImageRef data type and draw that.)

For more information about how to use the new UIKit functions to create PDF content, see “Graphics andDrawing” in iPad Programming Guide.

Xcode Tools

Xcode includes new features to make developing applications that run on iPad much simpler, including thefollowing:

Xcode Tools 252010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.2

Page 26: WhatsNewIniPhoneOS

■ Xcode simplifies the process of sharing code between your iPhone and iPad applications by helping youupdate your existing iPhone projects to include the necessary files to support iPad. The Transitioncommand (in the Project menu) creates a new target for the iPad and modifies a copy of your project’snib files to support the larger screen size. For more information on how to use this command, see iPadProgramming Guide.

■ Xcode simplifies the validation and submission process of your applications by allowing you to debugsigned applications.

■ You can now easily transfer your iPhone developer identity information to a new computer. The Organizerwindow includes an option to export your profile and certificate information. To begin developing ona new computer, all you have to do is import the resulting data file into Xcode on that computer.

■ Interface Builder supports the new view controllers and window sizes available for iPad.

API Changes

The following frameworks and technologies include additional incremental changes.

UIKit Framework Changes

The UIKit framework includes the following additions:

■ The UIBezierPath class is a new class that supports the creation of vector-based shapes. This classprovides an object-oriented wrapper around Core Graphics paths.

■ The UIScrollViewDelegate protocol includes additional methods for processing zoom-related eventsin a scroll view.

■ Modal view controllers can now be presented in a style other than full screen. The UIViewControllerclass includes a modalPresentationStyle property that allows you to present modal view controllersusing one of several predefined styles.

■ The UIMenuController class now allows you to add custom menu items. You can use custom menuitems to augment the Cut, Copy, Paste, and Select behavior provided by the system.

■ The UITextChecker class supports spell-checking of strings and aids in word completion.

■ Support for popovers, described in “Popovers” (page 21).

■ The UISplitViewController class, described in “Split Views” (page 21).

■ Support for gesture recognizers, described in “Gesture Recognizers” (page 22).

■ Support for implementing custom input and accessory views, described in “Custom Input Views” (page22).

■ Support for getting information about externally connected displays, described in “External DisplaySupport” (page 22).

■ Support for creating PDF files, described in “PDF Generation” (page 25).

■ Support for previewing and opening documents, described in “Document Support” (page 25).

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

26 API Changes2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.2

Page 27: WhatsNewIniPhoneOS

Media Player Framework Changes

The video classes in the Media Player framework (MediaPlayer.framework) have been redesigned to giveyou more control over the presentation of video content. Instead of simply playing a video full screen, theMPMoviePlayerController class now vends a view that you can incorporate into your interface howeveryou want. This class also includes more sophisticated support for managing and controlling the playback ofmovies.

For situations where you want a simpler alternative to movie presentation, you can now use theMPMoviePlayerViewController class. This new class provides a view controller-based wrapper for a movieinterface and is for applications that want the same basic behavior offered by the older movie player controllerdesign.

For information about the new classes available in this framework, see Media Player Framework Reference.

Core Animation Changes

The Core Animation technology (defined in QuartzCore.framework) includes the following additionalfeatures:

■ The CATextLayer class is now available for incorporating text-based content into your layer hierarchies.

■ You can now apply shadow effects to a layer and customize the appearance of the shadow using theshadowOpacity, shadowRadius, shadowOffset, shadowColor, and shadowPath properties.

■ You can configure the rasterization behavior of the layer using the shouldRasterize andrasterizationScale properties.

For more information about Core Animation classes, see Core Animation Reference Collection.

MapKit Framework Changes

The MKReverseGeocoder class now includes a placemark property for accessing the placemark that wascomputed by the reverse geocoding service. You can use this property to retrieve placemark informationafter the results are reported to the associated delegate object.

For more information about the classes of the MapKit framework, see Map Kit Framework Reference.

Foundation Framework Changes

The NSString class now includes the ability to search the text of a string using regular expressions. TheNSStringCompareOptions type includes a new flag called NSRegularExpressionSearch, which youcan use in conjunction with the following methods:

■ rangeOfString:options:

■ rangeOfString:options:range:

■ rangeOfString:options:range:locale:

API Changes 272010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.2

Page 28: WhatsNewIniPhoneOS

When you pass the NSRegularExpressionSearch as an option, the search string is interpreted as a regularexpression instead of a string literal. The regular expression syntax conforms to the syntax used by theInternational Components for Unicode (ICU) library. When performing regular expression searches, the onlyother options you can include in the mask parameter are the NSCaseInsensitiveSearch and theNSAnchoredSearch flags.

Because some regular expressions can trigger a match but still return a zero-length range, you should checkboth the location and range length of the result. If a match was unsuccessful, the search methods alwaysreturn a range whose location is set to NSNotFound and whose length is 0.

For more information about the NSString class and its methods, see NSString Class Reference. For moreinformation about regular expressions in the ICU library, go to http://site.icu-project.org/.

28 API Changes2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.2

Page 29: WhatsNewIniPhoneOS

This article summarizes the features that are available beginning with iPhone OS 3.1. For the latest updatesand information, you should also see iPhone SDK Release Notes for iPhone OS 3.1.

Video Editing Support

The UIKit framework now includes the UIVideoEditorController class, which provides a standard userinterface for editing video clips on supported devices.

Core Animation Enhancements

Introduced in iPhone OS 3.1, the CADisplayLink class is essentially a timer whose notifications aresynchronized with the screen refresh rate (or some partial interval thereof ). Graphics-intensive applicationscan use these notifications as a signal to begin preparing the next frame of content.

For more information about how to use this class, see CADisplayLink Class Reference.

Instruments

In iPhone OS 3.1 and later, the Instruments application includes support for gathering performance datawirelessly over Wi-Fi. This support allows you to gather performance metrics for applications that might needto use the 30-pin dock connector for other purposes. For example, you could use it to gather performancedata for an application that is communicating with an external accessory.

For more information about how to use this feature, see Instruments User Guide.

Video Editing Support 292010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.1

Page 30: WhatsNewIniPhoneOS

30 Instruments2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.1

Page 31: WhatsNewIniPhoneOS

This article summarizes the key features that are available beginning with iPhone OS 3.0. It also lists manyof the documents that were created or updated for the release.

Apple Push Notification Service

The Apple Push Notification Service provides a way to alert your users of new information, even when yourapplication is not actively running. Using this service, you can push text notifications, trigger audible alerts,or add a numbered badge to your application icon. These messages let users know that they should openyour application to receive the related information.

From a design standpoint, there are two parts to making push notifications work for your iPhone applications.First, you need to request the delivery of notifications to your iPhone application and then you need toconfigure your application delegate to process them. The delegate works together with the sharedUIApplication object to perform both of these tasks. Second, you need to provide a server-side processto generate the notifications in the first place. This process lives on your own local server and works withApple Push Notification Service to trigger the notifications.

For more information about how to configure your application to use remote notifications, see Local andPush Notification Programming Guide.

Cut, Copy, and Paste

The UIKit framework provides new classes to support pasteboard operations and also incorporates selectionand pasteboard behaviors into some existing UIKit views. You can use the new classes to incorporate supportcut, copy, and paste behaviors into your application. One of the key new classes is the UIPasteboard class,which manages the content on the systemwide pasteboards. It is through this class that you can now storeselected content and transfer it within your application or to other applications.

The UIPasteboard object provides built-in support for storing standard data types such as strings, images,colors, and URLs. These types represent some of the most common data types and make it easier to exchangecontent between applications. However, you can also exchange content in custom data formats supportedonly by your application or in more standardized interchange formats.

Several existing UIKit views now provide automatic support for text selection and pasteboard operations. Inparticular, the UITextField, UITextView, and UIWebView classes automatically handle text selections andthe display of an editing menu with the appropriate Cut, Copy, Paste, Select, and Select all commands.

For custom views, the UIKit framework also includes the UIMenuController class for managing the editingmenu. You use this class, together with your application’s own custom selection behavior, to allow the userto cut, copy, paste, and select custom content. The menu displays standard commands to cut or copy theselected content or to paste new content based on the operations currently supported by your view.

Apple Push Notification Service 312010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.0

Page 32: WhatsNewIniPhoneOS

For information about how to incorporate pasteboard support into your application, see “Document RevisionHistory” in iPhone Application Programming Guide. You should also consult “Handling Common Tasks” iniPhone Human Interface Guidelines for information about the interface guidelines associated with supportingcut, copy, and paste operations.

Accessory Support

The External Accessory framework (ExternalAccessory.framework) provides support for communicatingwith hardware accessories attached to an iPhone or iPod touch device. Accessories can be connected throughthe 30-pin dock connector of a device or wirelessly using Bluetooth. The External Accessory frameworkprovides a way for you to get information about each available accessory and to initiate communicationssessions. After that, you are free to manipulate the accessory directly using any commands it supports.

For more information about how to use this framework, see “Device Support” in iPhone ApplicationProgramming Guide. For information about the classes of the External Accessory framework, see ExternalAccessory Framework Reference. For information about developing accessories for iPhone and iPod touchdevices, go to http://developer.apple.com.

In App Purchase Support

The Store Kit framework (StoreKit.framework) provides a means for you to make additional content andservices available from within your iPhone applications. For example, you could use this feature to allow theuser to unlock additional application features. Or if you are a game developer, you could use it to offeradditional game levels. In both cases, the Store Kit framework handles the financial aspects of the transaction,processing payment requests through the user’s iTunes Store account and providing your application withinformation about the purchase.

The Store Kit focuses on the financial aspects of a transaction, ensuring that transactions occur securely andcorrectly. Your application handles the other aspects of the transaction, including the presentation of apurchasing interface and the downloading (or unlocking) of the appropriate content. This division of laborgives you control over the user experience for purchasing content. You decide what kind of purchasinginterface you want to present to the user and when to do so. You also decide on the delivery mechanismthat works best for your application.

For information about how to use the Store Kit framework, see In App Purchase Programming Guide and StoreKit Framework Reference.

Peer to Peer Support

The Game Kit framework (GameKit.framework) lets you add peer-to-peer network capabilities to yourapplications. Specifically, this framework provides support for peer-to-peer connectivity and in-game voicefeatures. Although these features are most commonly found in multiplayer network games, you can incorporatethem into non-game applications as well. The framework provides you with networking features through asimple (yet powerful) set of classes built on top of Bonjour. These classes abstract out many of the networkdetails, making it easy for developers who might be inexperienced with networking programming toincorporate networking features into their applications.

32 Accessory Support2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.0

Page 33: WhatsNewIniPhoneOS

For more information about how to use the Game Kit framework, see GameKit ProgrammingGuide and GameKit Framework Reference.

Maps API

The Map Kit framework (MapKit.framework) provides a map interface that you can embed into your ownapplication. Based on the behavior of this interface within the Maps application, this interface provides ascrollable map view that can be annotated with custom information. You can embed this view inside of yourown application views and programmatically set various attributes of the map, including the currentlydisplayed map region and the user’s location. You can also define custom annotations or use standardannotations (such as a pin marker) to highlight regions of the map and display additional information.

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

iPod Library Access

Several new classes and protocols have been added to the Media Player framework(MediaPlayer.framework) to allow access to the user’s audio library. You can use these classes to performthe following tasks:

■ Play audio items from the user’s library. This support lets you play all audio types supported by the iPodapplication.

■ Construct queues of audio items to play back.

■ Perform searches of the user’s audio library.

■ Access the user’s playlists (including smart, on-the-go, and genius playlists).

For more information about the classes of the Media Player framework, seeMediaPlayer FrameworkReference.

Audio Recording and Management

The AV Foundation framework (AVFoundation.framework) includes the following new classes and protocolsfor recording audio and managing audio sessions:

■ The AVAudioRecorder class provides audio recording capabilities. This class works together with anaudio delegate (conforming to the AVAudioRecorderDelegate protocol) to manage state changesduring recording.

■ The AVAudioSession class provides control over audio context including audio session category, samplerate, and I/O buffer duration. This class works with an audio session delegate (conforming to theAVAudioSessionDelegate protocol) to respond to audio hardware route changes and audiointerruptions.

■ New constants for configuring audio formats, audio encoding, and sample rate conversion for recording.

Maps API 332010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.0

Page 34: WhatsNewIniPhoneOS

For more information about the classes of the AV Foundation framework, see AV Foundation FrameworkReference.

Core Data

The Core Data framework (CoreData.framework) is a technology for managing the data model of aModel-View-Controller application. Core Data is intended for use in applications where the data model isalready highly structured. Instead of defining data structures programmatically, you use the graphical toolsin Xcode to build a schema representing your data model. At runtime, instances of your data-model entitiesare created, managed, and made available through the Core Data framework.

By managing your application’s data model for you, Core Data significantly reduces the amount of code youhave to write for your application. Core Data also provides the following features:

■ Storage of object data in a SQLite database for optimal performance

■ A new NSFetchedResultsController class to manage results for table views

■ Management of undo/redo beyond basic text editing

■ Support for the validation of property values

■ Support for propagating changes and ensuring that the relationships between objects remain consistent

■ Support for grouping, filtering, and organizing data in memory

If you are starting to develop a new application or are planning a significant update to an existing application,you should consider using Core Data. For an example of how to use Core Data in an iPhone application, seeCore Data Tutorial for iPhone OS. For more information about the classes of the Core Data framework, seeCore Data Framework Reference.

In App Email

The Message UI framework (MessageUI.framework) is a new framework that provides support for composingand queuing email messages in the user’s outbox. The composition support consists of a view controllerinterface that you can present in your application. You can populate the fields of this interface with thecontents of the message you want to send. You can set the recipients, subject, body content, and anyattachments you want to include with the message. The user then has the option of editing the messageprior to accepting it. Once accepted, the message is queued in the user’s outbox for delivery.

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

Streaming Video

There is now support for the playback of live video streamed over http. Streamed content can be playedback on an iPhone OS–based device using the MPMoviePlayerController class. The semantics of usingthis class have not changed. The main differences are in the preparation of the streamed content and howit is published on a web server.

34 Core Data2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.0

Page 35: WhatsNewIniPhoneOS

For more information about how to prepare content for video streaming, see HTTP Live Streaming Overview.

Safari Features

Safari supports the audio and video HTML elements, which allow you to embed audio and video contentinto your web applications. Safari also supports the Geolocation JavaScript classes, which work with theonboard location services to retrieve the current location of the device.

For more information about how to use these features in your web applications, see SafariWebContentGuide.

Shared Keychain Items

It is now possible for you to share Keychain items among multiple applications you create. Sharing itemsmakes it easier for applications in the same suite to interoperate more smoothly. For example, you could usethis feature to share user passwords or other elements that might otherwise require you to prompt the userfrom each application separately.

Sharing Keychain items involves setting up the proper entitlements in your application binaries. Using Xcode,you must create an Entitlements property list file that includes the supported entitlements for your application.The process for creating this file is described in iPhone Development Guide. For information about theentitlements you can configure, see the description for the SecItemAdd function in Keychain Services Reference.

Accessing shared items at runtime involves using the Keychain Services programming interface with theaccess groups you set up during development. For information about how to access the Keychain, seeKeychain Services Programming Guide.

Accessibility Support

Accessibility support makes it easier for people with visual, auditory, and physical disabilities to use iPhoneOS–based devices. In addition, users with the appropriate hardware can take advantage of the followingfeatures:

■ Zoom - magnifies the entire screen of the device.

■ White on Black - inverts the colors on the display.

■ Mono Audio - combines the left and right channels into a mono signal that is played in both audiochannels.

■ Speak auto-text - speaks the text that users type, along with any corrections or suggestions made bythe system.

■ Voice Control - allows users to make phone calls and control iPod playback using voice commands.

■ VoiceOver - provides an audible description of the elements touched and the actions taken by the user.

Safari Features 352010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.0

Page 36: WhatsNewIniPhoneOS

Developers can make their own applications accessible to VoiceOver users by taking advantage of the supportbuilt-in to the UIKit framework. All standard system views and controls now provide default descriptions foruse by VoiceOver. However, you can use the new accessibility interfaces in UIKit to improve on the defaultsupport and provide more accurate descriptions of your application’s views and controls. Providing morecontext-aware descriptions gives disabled users better access to your application’s content.

For information about how to make your own applications accessible, see Accessibility Programming Guidefor iPhone OS.

Compass Support

The Core Location framework now includes support for obtaining heading information from iPhone OS–baseddevices with a built-in magnetometer. Heading information obtained from such devices can be used toimplement a real-time compass or other navigation-related programs.

For more information about accessing compass information, see Core Location Framework Reference.

OpenGL ES 2.0

Applications can now take advantage of the OpenGL ES 2.0 specification on iPhone OS–based devices withappropriate graphics hardware. OpenGL ES 2.0 is a new version of the OpenGL ES specification that offersfeatures not available in OpenGL ES 1.1. Specifically, the new version provides support for shaders, includingfragment and vertex shaders. The use of shaders now eliminates the need for many of the fixed functioninterfaces that were part of the OpenGL ES 1.1 specification.

Note: OpenGL ES 1.1 is supported on all iPhone OS–based devices, whereas OpenGL ES 2.0 is supportedonly on newer hardware.

For more information about OpenGL ES 2.0 in particular, and about OpenGL ES support in general, seeOpenGLES Programming Guide for iPhone OS.

Additional Enhancements

In addition to the major new features in iPhone OS, several frameworks and technologies have receivedincremental updates to improve the development experience.

UIKit Framework Enhancements

The UIKit framework (UIKit.framework) has been enhanced to support major new features in iPhone OS3.0, such as cut, copy, and paste operations. In addition, this framework has some new classes and has minorimprovements to existing classes, including the following:

36 Compass Support2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.0

Page 37: WhatsNewIniPhoneOS

■ New classes (UIPasteboard and UIMenuController) and general improvements to the UITextField,UITextView, and UIWebView classes to support the selection of text and to support cut, copy, andpaste operations

■ Support for handling “motion” events, which currently consist of shake events. Typically, you use shakeevents to initiate undo operations but you may use them for other purposes as well; see “DocumentRevision History” in iPhone Application Programming Guide for more information.

■ Support in the UIDevice class for accessing the battery state and proximity sensor

■ Support for capturing video (on hardware that supports it) using the UIImagePickerController class

■ Enhancements to search bar controls, including the new UISearchDisplayController class to managesearch results

■ New support for one-step view rotations from a view controller; see UIViewController Class Reference

■ New modal transition styles, including support for flip and cross-fade transitions; see UIViewControllerClass Reference

■ Navigation controller support for a standard built-in toolbar whose contents can change to reflect thecurrently active view controller; see UINavigationController Class Reference

■ Improvements to table views, including support for new cell styles, more table reloading options, andsupport for customizing the title of delete confirmation buttons. There is also a new class(UILocalizedIndexedCollation) to help with data sorting and organization for table view sections.

■ Support for content stretching in the UIView class, which allows the creation of 3- or 9-part stretchedimages without using a stretchable UIImage or multiple image views

■ Enhanced support for data detection in the UITextView and UIWebView classes. This support lets youconfigure what types of data (phone numbers, URLS, and addresses) should be automatically detectedin text and converted to clickable links.

■ Enhanced support in UIWebView for displaying previews of RTF, RTFD, PDF, iWork, and Office documents

For more information about the classes of the UIKit framework, see UIKit Framework Reference. For guidanceon when to use the new features in your applications, see iPhone Human Interface Guidelines.

Foundation Framework Enhancements

The Foundation framework (Foundation.framework) has been updated to support the following featuresrelated to undo management and Core Data:

■ Inclusion of the NSUndoManager class to support Core Data and general undo operations

■ Inclusion of the NSExpression, NSPredicate, NSComparisonPredicate, NSCompoundPredicate,and NSValueTransformer classes to support Core Data

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

Core Audio Enhancements

Enhancements have been made to the Audio Toolbox, Audio Unit, and Core Audio frameworks, includingthe following additions:

Additional Enhancements 372010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.0

Page 38: WhatsNewIniPhoneOS

■ New support for decoding MP3 and AAC audio content in software. This support effectively allows youto play multiple compressed files simultaneously (one using the hardware decoder and one or moreusing the software decoder).

■ Enhanced support in the Audio Toolbox framework for determining if audio codecs are available insoftware, hardware, or both

■ Enhanced support in the Audio Unit framework for registering your audio units and connecting audiounit processing graphs in your iPhone application

■ Support for three new audio formats:

❏ DVI/Intel IMA ADPCM

❏ Microsoft GSM 6.10

❏ AES3-2003

For more information about the Core Audio interfaces, see Audio Toolbox Framework Reference, Audio UnitFramework Reference, and Core Audio Framework Reference.

API Changes

For information about the changes that occurred between iPhone OS 2.0 and iPhone OS 2.2, see iPhone 2.1API Diffs and iPhone 2.2 API Diffs. For information about the changes that occurred between iPhone OS 2.2and iPhone OS 3.0, see iPhone OS 3.0 API Diffs.

38 API Changes2010-06-04 | © 2010 Apple Inc. All Rights Reserved.

iPhone OS 3.0

Page 39: WhatsNewIniPhoneOS

This table describes the changes to What's New in iPhone OS.

NotesDate

Added information about new features in iPhone OS 4.0.2010-06-04

Moved the iPhone OS 3.1 information to its own article and added a new articlecovering features in iPhone OS 3.2.

2010-03-24

Updated the iPhone OS 3.0 article to reflect features introduced in all 3.x versionsof iPhone OS.

2009-08-27

Added new features related to the introduction of new iPhone hardware.2009-06-16

392010-06-04 | © 2010 Apple Inc. All Rights Reserved.

Document Revision History

Page 40: WhatsNewIniPhoneOS

402010-06-04 | © 2010 Apple Inc. All Rights Reserved.

Document Revision History