iOS 各版本中的新特性(What's New in iOS)- 目录翻译完成

iOS 各版本中的新特性(What's New in iOS)

太阳火神的美丽人生 (http://blog.csdn.net/opengl_es)

本文遵循“署名-非商业用途-保持一致”创作公用协议

转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS、Android、Html5、Arduino、pcDuino否则,出自本博客的文章拒绝转载或再转载,谢谢合作。


介绍 Introduction
文档组织结构 Organization of This Document 

iOS 7.0

用户界面更改 User Interface Changes 

UI重新设计 UI Redesign

视图动态行为 Dynamic Behaviors for Views 

文本工具箱 Text Kit 

64位支持 64-Bit Support

多任务加强 Multitasking Enhancements 

游戏 Games 

精灵工具箱框架 Sprite Kit Framework

游戏控制器框架 Game Controller Framework 

游戏中心改进 Game Center Improvements 

地图 Maps

空中投放 AirDrop

应用内音频 Inter-App Audio

点对点联接 Peer-to-Peer Connectivity

新框架 New Frameworks

已有框架的加强 Enhancements to Existing Frameworks 

UIKit框架 UIKit Framework 

商店工具箱框架 Store Kit Framework 

通行证工具箱框架 Pass Kit Framework 

开放图形库嵌入式系统版本 OpenGL ES 

消息用户界面框架 Message UI Framework 

Media Player FrameworkMap Kit Framework 

图象读写框架 Image I/O Framework 

iAd广告框架 iAd Framework 

游戏工具箱框架 Game Kit Framework

基础框架 Foundation Framework

核心电话框架 Core Telephony Framework

核心动作框架 Core Motion Framework

核心位置框架 Core Location Framework

核心基础框架 Core Foundation Framework

核心蓝牙框架 Core Bluetooth Framework

音视频基础框架 AV Foundation Framework

加速框架 Accelerate Framework

Objective-C语言 Objective-C

弃用的API Deprecated APIs 

iOS 6.1

地图开发包搜索组件 Map Kit Searches 

iOS 6.0

地图 Maps

社交框架 Social Framework

通行证开发包 Pass Kit

游戏中心 Game Center

提醒 Reminders

应用内支付 In-App Purchase

集合视图 Collection Views

UI元素状态保持 UI State Preservation

自动布局 Auto Layout

数据私有 Data Privacy

额外的框架加强 Additional Framework Enhancements 

UIKit 框架 UIKit Framework

开放嵌入式系统图形库 OpenGL ES

媒体播放框架 Media Player Framework

图像IO框架 Image IO Framework

iAd广告框架 iAd Framework

基础框架 Foundation Framework

外设框架 External Accessory Framework

事件开发包框架 Event Kit Framework

核心视频框架 Core Video Framework

核心媒体柜架 Core Media Framework

核心位置框架 Core Location Framework 

核心蓝牙框架 Core Bluetooth Framework

核心音频 Core Audio

音视频基础框架 AV Foundation Framework

广告支持框架 Ad Support Framework

促进框架 Accelerate Framework 

iOS 5.1 

文本输入视图中支持口述 Dictation Support in Text Input Views 

iOS 5.0

iCloud云存储开发接口 iCloud Storage APIs

iCloud云备份 iCloud Backup

ARC自动引用计数 Automatic Reference Counting

故事板 Storyboards 

创建故事板文件 Creating Storyboard Files 

准备迁移到一个新的视图控制器 Preparing to Transition to a New View Controller

编码呈现故事板视图控制器 Presenting Storyboard View Controllers Programmatically

报摊支持 Newsstand Support

AirPlay无线播放改进 AirPlay Improvements

新框架 New Frameworks

OpenGLES图形库开发包框架 GLKit Framework

核心图形框架 Core Image Framework

推特社交网框架 Twitter Framework

帐户框架 Accounts Framework

通用安全服务框架 Generic Security Services Framework

核心蓝牙 Core Bluetooth

应用设计层面的改进 App Design-Level Improvements

文档支持 Document Support

数据保护的改进 Data Protection Improvements

UIKit控件的自定义呈现 Custom Appearance for UIKit Controls

容器视图控制器支持 Container View Controller Support

设置 Settings

XCode工具 Xcode Tools

XCode改进 Xcode Improvements

OpenGL ES调试 OpenGL ES Debugging

UI自动化的加强 UI Automation Enhancements

分析工具集 Instruments

额外的框架加强 Additional Framework Enhancements

用户界面开发包框架 UIKit 

开放嵌入式系统图形库框架 OpenGL ES

开放音频库框架 OpenAL 

消息用户界面框架 Message UI

媒体播放框架 Media Player

地图开发包框架 Map Kit

iAd广告框架 iAd

游戏开发包框架 Game Kit 

基础框架 Foundation

外设框架 Accessory

事件开发包和事件开发包用户界面 Event Kit and Event Kit UI

核心动作框架 Core Motion

核心位置框架 Core Location

核心图形框架 Core Graphics

核心数据框架 Core Data

核心音频框架 Core Audio

音视频基础框架 AV Foundation

资料库框架 Assets Library

地址簿框架 Address Book

安全框架 Security 

iOS 4.3
AirPlay无线视频支持 AirPlay Video Support
框架加强 Framework Enhancements
音视频基础框架 AV Foundation
核心音频框架 Core Audio Frameworks
iAd广告框架 iAd
媒体播放框架 Media Player

用户界面开发包框架 UIKit 

iOS 4.2

打印 Printing

无线播放 AirPlay

核心音乐设备数字接口 Core MIDI

弱链接支持(弱引用的前身) Weak Linking Support

框架加强 Framework Enhancements

核心位置 Core Location 

游戏开发包 Game Kit 

广告 iAd

媒体播放 Media Player

用户界面开发包 UIKit 

iOS 4.1

游戏中心 Game Center

框架加强 Framework Enhancements 

音视频基础 AV Foundation 

资源库 Assets Library

核心文本 Core Text 

系统配置 System Configuration

用户界面开发包 UIKit 

iOS 4.0

多任务 Multitasking

集成技术 Integration Technologies 

位置通知 Local Notifications

事件开发包 Event Kit

核心动作 Core Motion

数据保护 Data Protection

核心电话 Core Telephony

广告 iAd 

图形和多媒体 Graphics and Multimedia

高分辩率屏幕支持 High-Resolution Screen Support

快速查看框架 Quick Look Framework 

音视频基础框架 AV Foundation 

资源库 Assets Library 

图像IO框架 Image I/O

核心媒体 Core Media

核心视频 Core Video

核心服务 Core Services

块对象 Block Objects

GCD异步中心分发执行框架 Grand Central Dispatch

加速促进框架 Accelerate Framework

Xcode 工具 Xcode Tools

Xcode 改进 Xcode Improvements

UI自动化开发接口 UI Automation API

框架加强 Framework Enhancements

UIKit框架加强 UIKit Framework Enhancements

Foundation框架加强 Foundation Framework Enhancements

OpenGL ES框架加强 OpenGL ES Enhancements

游戏开发包加强 Game Kit Enhancements

核心位置框架加强Core Location Enhancements

地图开发包框架加强 Map Kit Enhancements

消息用户界面加强 Message UI Enhancements

核心图形框架加强 Core Graphics Enhancements

ICU加强 ICU Enhancements

继承的改进 Inherited Improvements

文档修订历史 Document Revision History 


介绍 Introduction

本文档描述不同版本iOS中引入的开发级特性。针对每一个版本发布,本文档都提供链接到增量引用文档,列出该发布版本中引入的新的和更新的编程接口。

This document describes developer-level features that were introduced in different versions of iOS. For each shipping release, this document provides links to “delta” reference documents, which list the new and changed programming interfaces that were introduced in that release.

文档组织结构 Organization of This Document

本文档包含如下的文章 

This document includes the following articles:

“iOS 7.0”(page 8) 描述iOS 7.0中的新增和更新的特性。
“iOS 7.0”(page 8) describes the new and updated features in iOS 7.0.

“iOS 6.1”(page 25) describes the new and updated features in iOS 6.1.

“iOS 6.0”(page 26) describes the new and updated features in iOS 6.0.

“iOS 5.1”(page 38) describes the new and updated features in iOS 5.1.

“iOS 5.0”(page 39) describes the new and updated features in iOS 5.0.

“iOS 4.3”(page 62) describes the new and updated features in iOS 4.3.

“iOS 4.2”(page 65) describes the new and updated features in iOS 4.2.

“iOS 4.1”(page 69) describes the new and updated features in iOS 4.1.

“iOS 4.0”(page 71) describes the new and updated features in iOS 4.0.


iOS 7.0

iOS 7 is a major update with compelling features for developers to incorporate into their apps. The user interfacehas been completely redesigned. In addition, iOS 7 introduces a new animation system for creating 2D and2.5D games. Multitasking enhancements, peer-to-peer connectivity, and many other important features makeiOS 7 the most significant release since the first iPhone SDK.

This article summarizes the key developer-related features introduced in iOS 7. This version of the operatingsystem runs on current iOS devices. In addition to describing the key new features, this article lists the documentsthat describe those features in more detail.

For late-breaking news and information about known issues, seeiOS 7 Release Notes. For the complete list ofnew APIs added in iOS 7, seeiOS 7.0 API Diffs.

User Interface Changes

iOS 7 includes many new features intended to help you create great user interfaces.

UI Redesign

The iOS 7 user interface has been completely redesigned. Throughout the system, a sharpened focus onfunctionality and on the user’s content informs every aspect of design. Translucency, refined visual touches,and fluid, realistic motion impart clarity, depth, and vitality to the user experience. Whether you are creatinga new app or updating an existing one, keep these qualities in mind as you work on the design.

Apps compiled against the iOS 7 SDK automatically receive the new appearance for any standard system viewswhen the app is run on iOS 7. If you use Auto Layout to set the size and position of your views, those viewsare repositioned as needed. But there may still be additional work to do to make sure your interface has theappearance you want. Similarly, if you customize your app’s views, you may need to make changes to supportthe new appearance fully.

For guidance on how to design apps that take full advantage of the new look in iOS 7, seeiOS 7 Design Re-sources.


Dynamic Behaviors for Views

Apps can now specify dynamic behaviors forUIViewobjects and for other objects that conform to theUIDynamicItemprotocol. (Objects that conform to this protocol are calleddynamic items.) Dynamic behaviorsoffer a way to improve the user experience of your app by incorporating real-world behavior and characteristics,such as gravity, into your app’s animations. UIKit supports the following types of dynamic behaviors:

A UIAttachmentBehaviorobject specifies a connection between two dynamic items or between anitem and a point. When one item (or point) moves, the attached item also moves. The connection is notcompletely static, though. An attachment behavior has damping and oscillation properties that determinehow the behavior changes over time.

A UICollisionBehaviorobject lets dynamic items participate in collisions with each other and withthe behavior’s specified boundaries. The behavior also lets those items respond appropriately to collisions.

A UIGravityBehaviorobject specifies a gravity vector for its dynamic items. Dynamic items acceleratein the vector’s direction until they collide with other appropriately configured items or with a boundary.

A UIPushBehaviorobject specifies a continuous or instantaneous force vector for its dynamic items.
A
UISnapBehaviorobject specifies a snap point for a dynamic item. The item snaps to the point with a

configured effect. For example, it can snap to the point as if it were attached to a spring.

Dynamic behaviors become active when you add them to an animator object, which is an instance of theUIDynamicAnimatorclass. The animator provides the context in which dynamic behaviors execute. A givendynamic item can have multiple behaviors, but all of those behaviors must be animated by the same animatorobject.

For information about the behaviors you can apply, seeUIKit Framework Reference.

Text Kit

Text Kit is a full-featured set of UIKit classes for managing text and fine typography. Text Kit can lay out styledtext into paragraphs, columns, and pages; it easily flows text around arbitrary regions such as graphics; and itmanages multiple fonts. Text Kit is integrated with all UIKit text-based controls to enable apps to create, edit,display, and store text more easily—and with less code than was previously possible in iOS.

Text Kit comprises new classes and extensions to existing classes, including the following:

The NSAttributedStringclass has been extended to support new attributes.
The
NSLayoutManagerclass generates glyphs and lays out text.
The
NSTextContainerclass defines a region where text is laid out.
The
NSTextStorageclass defines the fundamental interface for managing text-based content.

For more information about Text Kit, seeText Programming Guide for iOS.

64-Bit Support

Apps can now be compiled for the 64-bit runtime. All system libraries and frameworks are 64-bit ready, meaningthat they can be used in both 32-bit and 64-bit apps. When compiled for the 64-bit runtime, apps may runfaster because of the availability of extra processor resources in 64-bit mode.

iOS uses the same LP64 model that is used by OS X and other 64-bit UNIX systems, which means fewer problemswhen porting code. For information about the iOS 64-bit runtime and how to write 64-bit apps, see64-BitTransition Guide for Cocoa Touch.

Multitasking Enhancements

iOS 7 supports two new background execution modes for apps:

Apps that regularly update their content by contacting a server can register with the system and belaunched periodically to retrieve that content in the background. To register, include theUIBackgroundModeskey with the fetchvalue in your app’sInfo.plistfile. Then, when your app islaunched, call thesetMinimumBackgroundFetchInterval:method to determine how often it receivesupdate messages. Finally, you must also implement theapplication:performFetchWithCompletionHandler:method in your app delegate.

Apps that use push notifications to notify the user that new content is available can fetch the content inthe background. To support this mode, include theUIBackgroundModeskey with theremote-notificationvalue in your app’sInfo.plistfile. You must also implement theapplication:didReceiveRemoteNotification:fetchCompletionHandler:method in your appdelegate.

Apps supporting either thefetchorremote-notificationbackground modes may be launched or movedfrom the suspended to background state at appropriate times. In the case of thefetchbackground mode,the system uses available information to determine the best time to launch or wake apps. For example, it doesso when networking conditions are good or when the device is already awake. You can also send silent pushnotifications—that is, notifications that do not display alerts or otherwise disturb the user.

For small content updates, use theNSURLRequestclass. To upload or download larger pieces of content inthe background, use the newNSURLSessionclass. This class improves on the existingNSURLConnectionclass by providing a simple, task-based interface for initiating and processingNSURLRequestobjects. A singleNSURLSessionobject can initiate multiple download and upload tasks, and use its delegate to handle anyauthentication requests coming from the server.

For more information about the new background modes, see “App States and Multitasking” iniOS AppProgramming Guide.

Games

iOS 7 includes enhanced support for games.

Sprite Kit Framework

The Sprite Kit framework (SpriteKit.framework) provides a hardware-accelerated animation systemoptimized for creating 2D and 2.5D games. Sprite Kit provides the infrastructure that most games need, includinga graphics rendering and animation system, sound playback support, and a physics simulation engine. UsingSprite Kit frees you from creating these things yourself, and it lets you focus on the design of your content andthe high-level interactions for that content.

Content in a Sprite Kit app is organized into scenes. A scene can include textured objects, video, path-basedshapes, Core Image filters, and other special effects. Sprite Kit takes those objects and determines the mostefficient way to render them onscreen. When it is time to animate the content in your scenes, you can useSprite Kit to specify explicit actions you want performed, or you can use the physics simulation engine to definephysical behaviors (such as gravity, attraction, or repulsion) for your objects.

In addition to the Sprite Kit framework, there are Xcode tools for creating particle emitter effects and textureatlases. You can use the Xcode tools to manage app assets and update Sprite Kit scenes quickly.

For more information about how to use Sprite Kit, seeSprite Kit Programming Guide. To see an example ofhow to use Sprite Kit to build a working app, seecode:Explained Adventure.

Game Controller Framework

The Game Controller framework (GameController.framework) lets you discover and configureMade-for-iPhone/iPod/iPad (MFi) game controller hardware in your app. Game controllers can be devicesconnected physically to an iOS device or connected wirelessly over Bluetooth. The Game Controller frameworknotifies your app when controllers become available and lets you specify which controller inputs are relevantto your app.

For more information about supporting game controllers, seeGame Controller Programming Guide.

Game Center Improvements

Game Center includes the following improvements:

Turn-based matches now support a new feature known asexchanges. Exchanges let players initiate actionswith other players, even when it is not their turn. You can use this feature to implement simultaneousturns, player chats, and trading between players.

The limit on per-app leaderboards has been raised from 25 to 100. You can also organize your leaderboardsusing aGKLeaderboardSetobject, which increases the limit to 500.

You can add conditions to challenges that define when the challenge has been met. For example, achallenge to beat a time in a driving game might stipulate that other players must use the same vehicle.

The framework has improved its authentication support and added other features to prevent cheating.For more information about how to use the new Game Center features, seeGame Center Programming Guide.

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

Maps

The Map Kit framework (MapKit.framework) includes numerous improvements and features for apps thatuse map-based information. Apps that use maps to display location-based information can now take fulladvantage of the 3D map support found in the Maps app, including controlling the viewing perspectiveprogrammatically. Map Kit also enhances maps in your app in the following ways:

Overlays can be placed at different levels in the map content so that they appear above or below otherrelevant data.

You can apply an MKMapCameraobject to a map to add position, tilt, and heading information to itsappearance. The information you specify using the camera object imparts a 3D perspective on the map.

The MKDirectionsclass lets you ask for direction-related route information from Apple. You can usethat route information to create overlays for display on your own maps.

The MKGeodesicPolylineclass lets you create a line-based overlay that follows the curvature of theearth.

Apps can use the MKMapSnapshotterclass to capture map-based images.
The visual representation of overlays is now based on the
MKOverlayRendererclass, which replaces

overlay views and offers a simpler rendering approach.

Apps can now supplement or replace a map’s existing tiles using theMKTileOverlayandMKTileOverlayRendererclasses.

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

AirDrop

AirDrop lets users share photos, documents, URLs, and other kinds of data with nearby devices. AirDrop supportis now built in to the existingUIActivityViewControllerclass. This class displays different options forsharing the content that you specify. If you are not yet using this class, you should consider adding it to yourinterface.

To receive files sent via AirDrop, do the following:

In Xcode, declare support for the document types your app supports. (Xcode adds the appropriate keysto your app’sInfo.plistfile.) The system uses this information to determine whether your app canopen a given file.

Implement the application:openURL:sourceApplication:annotation:method in your appdelegate. (The system calls this method when a new file is received.)

Files sent to your app are placed in theDocuments/Inboxdirectory of your app’s home directory. If you planto modify the file, you must move it out of this directory before doing so. (The system allows your app to readand delete files in this directory only.) Files stored in this directory are encrypted using data protection, so youmust be prepared for the file to be inaccessible if the device is currently locked.

For more information about using an activity view controller to share data, seeUIActivityViewController ClassReference.

Inter-App Audio

The Audio Unit framework (AudioUnit.framework) adds support for Inter-App Audio, which enables theability to send MIDI commands and stream audio between apps on the same device. For example, you mightuse this feature to record music from an app acting as an instrument or use it to send audio to another appfor processing. To vend your app’s audio data, publish a I/O audio unit (AURemoteIO) that is visible to otherprocesses. To use audio features from another app, use the audio component discovery interfaces in iOS 7.

For information about the new interfaces, see the framework header files. For general information about theinterfaces of this framework, seeAudio Unit Framework Reference.

Peer-to-Peer Connectivity

The Multipeer Connectivity framework (MultipeerConnectivity.framework) supports the discovery ofnearby devices and the direct communication with those devices without requiring Internet connectivity. Thisframework makes it possible to create multipeer sessions easily and to support reliable in-order data transmissionand real-time data transmission. With this framework, your app can communicate with nearby devices andseamlessly exchange data.

The framework provides programmatic and UI-based options for discovering and managing network services.Apps can integrate theMCBrowserViewControllerclass into their user interface to display a list of peerdevices for the user to choose from. Alternatively, you can use theMCNearbyServiceBrowserclass to lookfor and manage peer devices programmatically.

For more information about the interfaces of this framework, seeMultipeer Connectivity Framework Reference.

New Frameworks

iOS 7 includes the following new frameworks:

The Game Controller framework (GameController.framework) provides an interface for communicatingwithgame-relatedhardware;see“GameControllerFramework”(page11).

The Sprite Kit framework (SpriteKit.framework) provides support for sprite-based animations andgraphics rendering; see “Sprite Kit Framework”(page 11).

The Multipeer Connectivity framework (MultipeerConnectivity.framework) provides peer-to-peernetworking for apps; see “Peer-to-Peer Connectivity”(page 14).

The JavaScript Core framework (JavaScriptCore.framework) provides Objective-C wrapper classesfor many standard JavaScript objects. Use this framework to evaluate JavaScript code and parse JSONdata. For information about the classes of this framework, see the framework header files.

The Media Accessibility framework (MediaAccessibility.framework) manages the presentation ofclosed-captioned content in your media files. This framework works in conjunction with new settings thatlet the user enable the display of closed captions.

The Safari Services framework (SafariServices.framework) provides support for programmaticallyadding URLs to the user’s Safari reading list. For information about the class provided by this framework,see the framework header files.

Enhancements to Existing Frameworks

In addition to its new features, iOS 7 also includes significant enhancements, organized here by framework.For a complete list of new interfaces, seeiOS 7.0 API Diffs .

UIKit Framework

The UIKit framework (UIKit.framework) includes the following enhancements:

All UI elements have been updated to present the new look associated with iOS 7.
UIKit Dynamics lets you mimic real-world effects such as gravity in your animations; see
“Dynamic Behaviors

for Views”(page 9).

Text Kit provides sophisticated text editing and display capabilities; see“Text Kit”(page 9).

The UIViewclass defines the following additions:

The tintColorproperty applies a tint color to both the view and its subviews. For information on howto apply tint colors, seeiOS 7 UI Transition Guide.

You can create keyframe-based animations using views. You can also make changes to your views andspecifically prevent any animations from being performed.

The UIViewControllerclass defines the following additions:
View controller transitions can be customized, driven interactively, or replaced altogether with ones you

designate.

View controllers can now specify their preferred status bar style and visibility. The system uses the providedinformation to manage the status bar style as new view controllers appear. You can also control how thisbehavior is applied using the UIViewControllerBasedStatusBarAppearancekey in your app’sInfo.plistfile.

The UIMotionEffectclass defines the basic behavior for motion effects, which are objects that definehow a view responds to device-based motion.

Collection views add support for intermediate layout transitions and invalidation contexts (invalidationcontexts help you improve the performance of your custom layout code). You can also apply UIKit Dynamicsto collection view layout attributes to animate the items in the collection.

The imageNamed:method ofUIImagesupports retrieving images stored in asset catalogs, which are away to manage and optimize assets that have multiple sizes and resolutions. You create asset catalogs inXcode.

There are methods on UIViewandUIScreenfor creating a snapshot of their contents. Generatingsnapshots using these new interfaces is significantly faster than rendering the view or screen contentsyourself.

Gesture recognizers can specify dependencies dynamically to ensure that one gesture recognizer failsbefore another is considered.

The UIKeyCommandclass wraps keyboard events received from an external hardware keyboard. Theseevents are delivered to the app’s responder chain for processing.

A UIFontDescriptorobject describes a font using a dictionary of attributes. Use font descriptors tointeroperate with other platforms.

The UIFontandUIFontDescriptorclasses support dynamic text sizing, which improves legibility fortext in apps. With this feature, the user controls the desired font size that all apps in the system shoulduse.

The UIActivityclass now supports new activity types, including activities for sending items via AirDrop,adding items to a Safari reading list, and posting content to Flickr, Tencent Weibo, and Vimeo.

The UIApplicationDelegateprotocol adds methods for handling background fetch behaviors.
The
UIScreenEdgePanGestureRecognizerclass is a new gesture recognizer that tracks pan gestures

that originate near an edge of the screen.

UIKit adds support for running in a guided-access mode, which allows an app to lock itself to preventmodification by the user. This mode is intended for institutions such as schools, where users bring theirown devices but need to run apps provided by the institution.

State restoration now allows the saving and restoration of any object. Objects adopting theUIStateRestoringprotocol can write out state information when the app moves to the backgroundand have that state restored during subsequent launches.

Table views now support estimating the height of rows and other elements, which improves scrollingperformance.

You can now more easily configure aUISearchDisplayControllerobject to work with aUINavigationBarobject.

For information about the classes of this framework, seeUIKit Framework Reference.

Store Kit Framework

The Store Kit framework (StoreKit.framework) has migrated to a new receipt system that developers canuse to verify in-app purchases on the device itself. You can also use it to verify the app purchase receipt onthe server.

For more information about how to use this new receipt system, seeReceipt Validation Programming Guide.

Pass Kit Framework

The Pass Kit framework (PassKit.framework) includes new APIs for adding multiple passes in a singleoperation.

These new features were added to the pass file format:

New keys specify the expiration date for a pass.
You can specify that a pass is relevant only when it is in the vicinity of specific iBeacons.

New attributes control how a pass is displayed. You can group passes together, display links with customtext on the back of a pass, and control how time values are displayed on the pass.

You can now associate extra data with a pass. This data is available to your app but is not displayed to theuser.

You can designate which data detectors to apply to the fields of your passes.
For information about how to use Pass Kit in your app, see
Passbook Programming Guide. For information

about the pass file format, seePassbook Package Format Reference.

OpenGL ES

iOS 7 adds support for OpenGL ES 3.0 and adds new features to OpenGL ES 2.0.

OpenGL ES 3.0 includes as core functionality the features of many extensions supported in OpenGL ES 2.0on iOS. But OpenGL ES 3.0 also adds new features to the OpenGL ES shading language and new corefunctionality that has never been available on mobile processors before, including multiple render targetsand transform feedback. You can use OpenGL ES 3 to more easily implement advanced renderingtechniques, such as deferred rendering.

To create an OpenGL ES 3 context on devices that support it, pass thekEAGLRenderingAPIOpenGLES3constant to theinitWithAPI:method.

OpenGL ES 2 adds the following new extensions:
The
EXT_sRGBextension adds support for sRGB framebuffer operations.

The GL_EXT_pvrtc_sRGBextension adds support for sRGB texture data compressed in the PVRTCtexture compression format. (This extension is also supported in OpenGL ES 3.0).

The GL_EXT_draw_instancedandGL_EXT_instanced_arraysextensions can improve renderingperformance when your app draws multiple instances of the same object. You use a single call todraw instances of the same object. You add variation to each instance by specifying how fast eachvertex attribute advances or by referencing an ID for each instance in your shader.

Textures can be accessed in vertex shaders in both OpenGL ES 2.0 and 3.0. Query the value of theMAX_VERTEX_TEXTURE_IMAGE_UNITSattribute to determine the exact number of textures you canaccess. In earlier versions of iOS, this attribute always had a value of0.

For more information, see OpenGL ES Programming Guide for iOSandiOS Device Compatibility Reference.

Message UI Framework

In the Message UI framework, theMFMessageComposeViewControllerclass adds support for attachingfiles to messages.

For information about the new interfaces, see the framework header files. For information about the classesof this framework, seeMessage UI Framework Reference.

Media Player Framework

In the Media Player framework, theMPVolumeViewclass provides support for determining whether wirelessroutes such as AirPlay and Bluetooth are available for the user to select. You can also determine whether oneof these wireless routes is currently active. For information about the new interfaces, see the framework headerfiles.

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

Map Kit Framework

The Map Kit framework (MapKit.framework) includes changes that are described in “Maps”(page 12).For information about the classes of this framework, seeMap Kit Framework Reference.

Image I/O Framework

The Image I/O framework (ImageIO.framework) now has interfaces for getting and setting image metadata.For information about the new interfaces, see the framework header files. For information about the classes

of this framework, see Image I/O Reference Collection.

iAd Framework

The iAd framework (iAd.framework) includes two extensions to other frameworks that make it easier toincorporate ads into your app’s content:

The framework introduces new methods on theMPMoviePlayerControllerclass that let you run adsbefore a movie.

The framework extends the UIViewControllerclass to make it easier to create ad-supported content.You can now configure your view controllers to display ads before displaying the actual content theymanage.

For information about the new interfaces, see the framework header files. For information about the classesof this framework, seeAd Support Framework Reference.

Game Kit Framework

The Game Kit framework (GameKit.framework) includes numerous changes, which are described in “GameCenter Improvements”(page 12).

For information about the classes of this framework, seeGame Kit Framework Reference.

Foundation Framework

The Foundation framework (Foundation.framework) includes the following enhancements:

The NSDataclass adds support for Base64 encoding.

The NSURLSessionclass is a new class for managing the acquisition of network-based resources. (Youcan use it to download content even when your app is suspended or not running.) This class serves as areplacement for theNSURLConnectionclass and its delegate; it also replaces theNSURLDownloadclassand its delegate.

The NSURLComponentsclass is a new class for parsing the components of a URL. This class supports theURI standard (rfc3986/STD66) for parsing URLs.

The NSNetServiceandNSNetServiceBrowserclasses support peer-to-peer discovery over Bluetoothand Wi-Fi.

The NSURLCredentialandNSURLCredentialStorageclasses let you create credentials with asynchronizable policy, and they provide the option of removing credentials with a synchronizable policyfrom iCloud.

The NSURLCache,NSURLCredentialStorage, andNSHTTPCookieStorageclasses now support theasynchronous processing of storage requests.

The NSCalendarclass supports new calendar types.
The
NSProgressclass provides a general-purpose way to monitor the progress of an operation and report

that progress to other parts of your app that want to use it.

For information about the new interfaces, see the framework header files and Foundation release notes. Forgeneral information about the classes of this framework, seeFoundation Framework Reference.

Core Telephony Framework

The Core Telephony framework (CoreTelephony.framework) lets you get information about the type ofradio technology in use by the device. Apps developed in conjunction with a carrier can also authenticateagainst a particular subscriber for that carrier.

For information about the new interfaces, see the framework header files. For general information about theclasses of the Core Telephony framework, seeCore Telephony Framework Reference.

Core Motion Framework

The Core Motion framework (CoreMotion.framework) adds support for step counting and motion tracking.With step counting, the framework detects movements that correspond to user motion and uses that informationto report the number of steps to your app. Because the system detects the motion, it can continue to gatherstep data even when your app is not running. Alongside this feature, the framework can also distinguishdifferent types of motion, including different motions reflective of travel by walking, by running, or byautomobile. Navigation apps might use that data to change the type of directions they give to users.

For information about the classes of this framework, seeCore Motion Framework Reference.

Core Location Framework

The Core Location framework (CoreLocation.framework) supports region monitoring and ranging usingBluetooth devices. Region monitoring lets you determine whether the iOS device enters a specific area, andranging lets you determine the relative range of nearby Bluetooth devices. For example, an art museum mightuse region monitoring to determine whether a person is inside a particular gallery, and then place iBeaconsnear each painting. When the person is standing by a painting, the app would display information about it.

The framework also supports deferring the delivery of location updates until a specific time has elapsed or theuser has moved a minimum distance.

For general information about the classes of this framework, seeCore Location Framework Reference.

Core Foundation Framework

The Core Foundation framework (CoreFoundation.framework) now lets you schedule stream objects ondispatch queues.

For information about the new interfaces, see the framework header files. For general information about theinterfaces of this framework, seeCore Foundation Framework Reference.

Core Bluetooth Framework

The Core Bluetooth framework (CoreBluetooth.framework) includes the following enhancements:

The framework supports saving state information for central and peripheral objects and restoring thatstate at app launch time. You can use this feature to support long-term actions involving Bluetooth devices.

The central and peripheral classes now use anNSUUIDobject to store unique identifiers.You can now retrieve peripheral objects from a central manager synchronously.

For information about the classes of this framework, seeCore Bluetooth Framework ReferenceandCore BluetoothProgramming Guide.

AV Foundation Framework

The AV Foundation framework (AVFoundation.framework) includes the following enhancements:

The AVAudioSessionclass supports the following new behaviors:
Selecting the preferred audio input, including audio from built-in microphones

Multichannel input and output

The AVVideoCompositingprotocol and related classes let you support custom video compositors.

The AVSpeechSynthesizerclass and related classes provide speech synthesis capabilities.

The capture classes add support and interfaces for the following features:

Discovery of a camera’s supported formats and frame rates
High fps recording
Still image stabilization
Video zoom (true and digital) in recordings and video preview, including custom rampingReal-time discovery of machine-readable metadata (barcodes)

Autofocus range restriction
Smooth autofocus for capture
Sharing your app’s audio session during captureAccess to the clocks used during capture

Access to capture device authorization status (user must now grant access to the microphone andcamera)

Recommended settings for use with data outputs and asset writer

There are new metadata key spaces for supported ISO formats such as MPEG-4 and 3GPP, and improvedsupport for filtering metadata items when copying those items from source assets to output files usingtheAVAssetExportSessionclass.

The AVAssetWriterclass provides assistance in formulating output settings, and there are new levelconstants for H.264 encoding.

The AVPlayerLayerclass adds thevideoRectproperty, which you can use to get the size and positionof the video image.

The AVPlayerItemclass supports the following changes:
Asset properties can be loaded automatically when
AVPlayerItemobjects are prepared for playback.

When you link your app against iOS 7 SDK, the behavior when getting the values of player itemproperties—such as theduration,tracks, orpresentationSizeproperties—is different fromthe behaviors in previous versions of iOS. The properties of this class now return a default value andno longer block your app if theAVPlayerItemobject is not yet ready to play. As soon as the playeritem’s status changes toAVPlayerItemStatusReadyToPlay, the getters reflect the actual valuesof the underlying media resource. If you use key-value observing to monitor changes to the properties,your observers are notified as soon as changes are available.

The AVPlayerItemLegibleOutputclass can process timed text from media files.
The
AVAssetResourceLoaderDelegateprotocol now supports loading of arbitrary ranges of bytes

from a media resource.
For information about the new interfaces, see the framework header files. For general information about the

classes of this framework, seeAV Foundation Framework Reference.

Accelerate Framework

The Accelerate framework (Accelerate.framework) includes the following enhancements:

Improved support for manipulating Core Graphics data types
Support for working with grayscale images of 1, 2, or 4 bits per pixel
New routines for converting images between different formats and transforming image contentsSupport for biquad (IIR) operations

For information about the new interfaces, see the framework header files. For general information about thefunctions and types of this framework, seeAccelerate Framework Reference.

Objective-C

The Objective-C programming language has been enhanced to support modules, which yield faster builds andshorter project indexing times. Module support is enabled in all new projects created using Xcode 5. If youhave existing projects, you must enable this support explicitly by modifying your project’s Enable Modulessetting.

Deprecated APIs

From time to time, Apple adds deprecation macros to APIs to indicate that those APIs should no longer beused in active development. When a deprecation occurs, it is not an immediate end-of-life to the specified API.Instead, it is the beginning of a grace period for transitioning off that API and onto newer and more modernreplacements. Deprecated APIs typically remain present and usable in the system for a reasonable amount oftime past the release in which they were deprecated. However, active development on them ceases and theAPIs receive only minor changes—to accommodate security patches or to fix other critical bugs. DeprecatedAPIs may be removed entirely from a future version of the operating system.

As a developer, it is important that you avoid using deprecated APIs in your code as soon as possible. At aminimum, new code you write should never use deprecated APIs. And if you have existing code that usesdeprecated APIs, update that code as soon as possible. Fortunately, the compiler generates warnings wheneverit spots the use of a deprecated API in your code, and you can use those warnings to track down and removeall references to those APIs.

This release includes deprecations in the following technology areas:

The Map Kit framework includes deprecations for theMKOverlayViewclass and its various subclasses.The existing overlay views have been replaced with an updated set of overlay renderer objects that descendfrom theMKOverlayRendererclass. For more information about the classes of this framework, seeMapKit Framework Reference.

The Audio Session API in the Audio Toolbox framework is deprecated. Apps should use theAVAudioSessionclass in the AV Foundation framework instead.

The CLRegionclass in the Core Location framework is replaced by theCLCircularRegionclass. TheCLRegionclass continues to exist as an abstract base class that supports both geographic and beaconregions.

The UUIDproperty of theCBCentralclass is deprecated. To specify the unique ID of your central objects,use theidentifierproperty instead.

The Game Kit framework contains assorted deprecations intended to clean up the existing API and providebetter support for new features.

The UIKit framework contains the following deprecations:

The wantsFullScreenLayoutproperty ofUIViewControlleris deprecated. In iOS 7 and later,view controllers always support full screen layout.

UIColorobjects that provided background textures for earlier versions of iOS are gone.

Many drawing additions to theNSStringclass are deprecated in favor of newer variants.Thegethostuuidfunction in thelibsyscalllibrary is deprecated.

In iOS 7 and later, if you ask for the MAC address of an iOS device, the system returns the value02:00:00:00:00:00. If you need to identify the device, use the identifierForVendorproperty ofUIDeviceinstead. (Apps that need an identifier for their own advertising purposes should consider usingtheadvertisingIdentifierproperty of ASIdentifierManagerinstead.)

For a complete list of specific API deprecations, seeiOS 7.0 API Diffs.


iOS 6.1

This article summarizes the key developer-related features introduced in iOS 6.1. This version of the operatingsystem runs on current iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.

For late-breaking news and information about known issues, seeiOS 6.1 Release Notes. For the complete listof new APIs added in iOS 6.1, seeiOS 6.1 API Diffs.

Map Kit Searches

The Map Kit framework now lets you programmatically search for map-based addresses and points of interest.TheMKLocalSearchclass initiates a search for map-based content using a natural language string. In otherwords, you can enter place name information or portions of an address and have Map Kit return search resultsthat match the information you provide. For example, searching for the string “coffee” would return the locationof local coffee bars along with information about each one.

For more information about the classes of the Map Kit framework, including the new search-related classes,seeMap Kit Framework Reference.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.25

iOS 6.0

This article summarizes the key developer-related features introduced in iOS 6. This version of the operatingsystem runs on current iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.

For late-breaking news and information about known issues, seeiOS 6.0 Release Notes. For the complete listof new APIs added in iOS 6, seeiOS 6.0 API Diffs.

Maps

In addition to the new map tiles provided by Apple, the Maps app and MapKit framework now support additionalinteractions with other apps. Apps that do not incorporate their own map support now have an easier way tolaunch the Maps app and display points of interest or directions. Apps that offer routing information, such asturn-by-turn navigation services, can now register as a routing app and make those services available to theentire system.

Registering as a routing app gives you more opportunities to get your app in front of users. Routing apps arenot limited to just driving or walking directions. Routing apps can also include apps that provide directionsfor the user’s favorite bicycle or hiking trail, for air routes, and for subway or other public transportation lines.And your app does not even have to be installed on the user’s device. Maps knows about routing apps in theApp Store and can provide the user with the option to purchase those apps and use them for directions.

Apps that do not provide routing directions themselves can also take advantage of both Maps and routingapps. Apps can use new interfaces to ask the Maps app to display specific locations or to display routingdirections between two locations.

For information about how to provide directions from your app, or how to use the Maps app to display directions,seeLocation and Maps Programming Guide.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.26

iOS 6.0

Social Framework

Social Framework

The Social framework (Social.framework) provides a simple interface for accessing the user’s social mediaaccounts. This framework supplants the Twitter framework that was introduced in iOS 5 and adds support forother social accounts, including Facebook and Sina’s Weibo service. Apps can use this framework to post statusupdates and images to a user’s account. This framework works with the Accounts framework to provide asingle sign-on model for the user and to ensure that access to the user’s account is approved.

The UIKit framework also provides a newUIActivityViewControllerclass for displaying actions that theuser might perform on some selected content. One use of this class is to allow the user to post content tosocial accounts, such as Twitter or Facebook. You present this class modally on iPhone or using a popovercontroller on iPad. When the user taps one of the buttons, the view controller presents a new interface toperform the associated action.

For more information about the Social framework, seeSocial Framework Reference. For information about theUIActivityViewControllerclass, seeUIKit Framework Reference.

Pass Kit

Pass Kit is a new technology that uses web services, a new file format, and an Objective-C framework(PassKit.framework) to implement support for downloadable passes. Companies can create passes torepresent items such as coupons, boarding passes, event tickets, and discount cards for businesses. Instead ofcarrying a physical representation of these items, users can now store them on their iOS device and use themthe same way as before.

Passes are created by your company’s web service and delivered to the user’s device via email, Safari, or yourcustom app. The pass itself uses a special file format and is cryptographically signed before being delivered.The file format identifies relevant information about the service being offered so that the user knows what itis for. It might also contain a bar code or other information that you can then use to validate the card so thatit can be redeemed or used.

For more information about Pass Kit and for information how to add support for it into your apps, seePassbookProgramming Guide.

Game Center

Game Center has been updated and new features have been added to improve the game playing experience.The Game Kit framework (GameKit.framework) includes the following incremental and major changes:

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.27

iOS 6.0

Reminders

Challenges allow a player to challenge a friend to beat an achievement or score. Players can issue challengesfrom the Game Center app. You can also use theGKChallengeclass to issue challenges from within yourgame.

The GKGameCenterViewControllerclass incorporates all of the previous capabilities of the leaderboard,achievement and friend request view controllers. You can use the previous view controllers too, but theynow present the appropriate tab in the game center view controller.

The process for authenticating a local player has changed. In the new process, you set theauthenticateHandlerproperty to a block that performs all the authentication steps. Once set, GameKit automatically authenticates the local player when necessary. However, Game Kit does not display theauthentication interface directly. Instead, it lets your handler present the provided authentication viewcontroller, giving you more control over exactly when the authentication user interface appears.

The turn-based match class now has support for player timeouts. When using a timeout, you specify a listof players in order. If a player times out, the next player in the list is asked to take a turn instead.

The GKMatchmakerclass has been updated to include better support for programmatic matchmaking.It is now easier to implement your own user interface for matchmaking on top of Game Center’s built-insupport.

The GKPlayerclass now supports display names for players.

The GKMatchclass provides a method to estimate which player has the best connection to Game Center.You can use this method when implementing your own client-server architecture on top of theGKMatchinfrastructure.

The GKAchievementclass now allows multiple achievements to be submitted at the same time.For more information about how to use Game Center in your app, seeGame Center Programming Guide.

Reminders

The Event Kit framework now includes interfaces for creating and accessing reminders on the user’s device.The reminders you create show up in the Reminders app along with ones created by the user. Reminders caninclude proximity or time-based alarms.

For more information about the interfaces of the Event Kit framework, including the new interfaces for creatingreminders, seeEvent Kit Framework Reference.

In-App Purchase

The Store Kit framework (StoreKit.framework) now supports the purchasing of iTunes content inside yourapp and provides support for having downloadable content hosted on Apple servers. With in-app contentpurchases, you present a view controller that lets users purchase apps, music, books, and other iTunes contentdirectly from within your app. You identify the items you want to make available for purchase but the rest ofthe transaction is handled for you by Store Kit.

Prior to iOS 6, you were responsible for managing any downloadable content made available through in apppurchase. Hosted downloads now simplify the work you need to do to make content available to users. Thenew SKDownloadclass represents a downloadable piece of content. In addition, theSKPaymentTransactionclass has been modified to provide an array of download objects for any hosted content. To download a pieceof content, you queue a download object on the payment queue. When the download completes, your paymentqueue observer is notified.

For more information about the classes of the Store Kit framework, seeStore Kit Framework Reference.

Collection Views

The UICollectionViewclass offers a new way to present ordered data to users. With a collection view object,you are now able to define the presentation and arrangement of embedded views. The collection view classworks closely with an accompanying layout object to define the placement of individual data items. UIKitprovides a standard flow-based layout object that you can use to implement multi-column grids containingitems of standard or varying sizes. And if you want to go beyond grid layouts, you can create your own customlayout objects to support any layout style you choose.

Collection views work with a dedicated group of classes to support the display of items. In addition to cells,collection views can have supplementary views and decoration views. The usage and placement of these viewsis controlled entirely by the layout object. For example, the flow-based layout object uses supplementary viewsto implement header and footer views for sections in the collection view.

Other noteworthy features of collection views include:

A UICollectionViewControllerclass for managing the presentation of collection views in your appSupport for animating content within the collection view
Batch support for inserting, moving, and deleting items
A simplified model for creating and managing cells and other views

For more information about using collection views to implement your user interface, seeCollection ViewProgramming Guide for iOS.

UI State Preservation

State preservation makes it easier for apps to restore their user interface to the state it was in when the userlast used it. Prior to iOS 6, apps were encouraged to write out information about their current interface statein the event that the app was terminated. Upon relaunch, the app could use this state to restore its interfaceand make it seem as if the app had never quit. State preservation simplifies this process by providing you withall of the core infrastructure for saving and restoring your app’s interface.

Implementing state preservation still requires effort on your part to identify what parts of your interface tosave. In addition, the preservation and restoration processes can be customized to accommodate unforeseencircumstances, such as missing content during a subsequent relaunch or changes to your app’s UI.

For more information about how to add state preservation support to your app, seeiOS App ProgrammingGuide.

Auto Layout

Auto layout improves upon the “springs and struts” model previously used to lay out the elements of a userinterface. With auto layout, you define rules for how to lay out the elements in your user interface. These rulesexpress a larger class of relationships and are more intuitive to use than springs and struts.

The entities used in Auto Layout are Objective-C objects called constraints. This approach brings you a numberof benefits:

Localization through swapping of strings alone, instead of also revamping layouts.

Mirroring of user-interface elements for right-to-left languages like Hebrew and Arabic.

Better layering of responsibility between objects in the view and controller layers.

A view object usually knows best about its standard size and its positioning within its superview andrelative to its sibling views. A controller can override these values if something nonstandard is required.

For more information about using auto layout, seeAuto Layout Guide.

Data Privacy

In addition to location data, the system now asks the user’s permission before allowing third-party apps toaccess certain user data, including:

RemindersPhoto Library

For contact, calendar, and reminder data, your app needs to be prepared to be denied access to these itemsand to adjust its behavior accordingly. If the user has not yet been prompted to allow access, the returnedstructure is valid but contains no records. If the user has denied access, the app receives aNULLvalue or nodata. If the user grants permission to the app, the system subsequently notifies the app that it needs to reloador revert the data.

For the photo library, the existing interface supports the app being denied access.

Your app can provide a description for how it intends to use the data in itsInfo.plistfile. That data is thendisplayed to the user when the system needs to prompt for access. For more information about the keys youneed to add to yourInfo.plistfile, see Information Property List Key Reference. For more information aboutaccessing specific kinds of data, see the respective framework reference.

Additional Framework Enhancements

In addition to the items discussed in the preceding sections, the following frameworks have additionalenhancements. For a complete list of new interfaces, seeiOS 6.0 API Diffs .

UIKit Framework

The UIKit framework (UIKit.framework)includes the following enhancements:

UIKit now supports state preservation for your app’s user interface; see“UI State Preservation”(page 30).Views now support constraint-based layout; see“Auto Layout”(page 30).

The UICollectionViewclass (and its supporting classes and protocols) support the presentation ofordered collections of items; see“Collection Views”(page 29).

UITextViewandUITextFieldnow support styled text using attributed strings.
UIKit now includes support for drawing
NSAttributedStringandNSMutableAttributedString

objects. In addition, string-based views now support attributed strings for content.Accessibility support has been improved to include new VoiceOver enhancements:

VoiceOver can now use gestures to trigger specific actions.

Developers can order items together in the element list that VoiceOver creates to provide a morelogical flow from element to element.

Scroll views can now provide a special status string during scrolling.

You can now post notifications that let the accessibility system know your app’s layout or UI havechanged.

New notifications provide information about the state of VoiceOver announcements.
The
UIActivityViewControllerclass adds support for sharing content via services like email, Twitter,

and Facebook; see also, “Social Framework”(page 27).

The UIDeviceclass adds a vendor-specific identifier.

The UIImageclass includes new initialization methods for specifying the scale factor of an image.

Appearance customization support has been added to theUIBarButtonItem,UIPageControl,UIPageViewController,UISwitch, andUIStepperclasses.

The UITableViewclass includes the following changes:
Support for a new
UITableViewHeaderFooterViewclass implements the table’s headers and

footers

A simplified model for creating and managing cells and other views.

The UITableViewControllerclass allows you to add a built-in refresh control (UIRefreshControl)to reload the table contents.

Storyboards allow you to unwind segues and specify restoration identifiers.

The UIWebViewclass provides a way to disable the incremental rendering of web content.

The UIViewControllerclass has new interfaces supporting the following behaviors:

New interfaces provide a clearer path for managing and tracking interface rotations.You can prevent a segue from being triggered.
Support has been added for unwinding segues.

You can now subclass UINavigationBarand incorporate your custom navigation bar into your app’snavigation interfaces.

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

OpenGL ES

OpenGL ES includes the following new extensions:

The GL_EXT_texture_storageextension allows your app to specify the entire structure of a texture in asingle call, allowing your textures to be optimized further by OpenGL ES.

The GL_APPLE_copy_texture_levelsextension builds on top of the functionality of theGL_EXT_texture_storageextension and allows a set of texture mipmaps to be copied from one textureto another.

The GL_EXT_map_buffer_rangeextension improves performance when you only need to modify a subsetof a buffer object.

The GL_APPLE_syncextension provides fine-grain synchronization to your app. It allows you to choose asubset of submitted OpenGL ES commands and block until those commands complete.

The GL_EXT_shader_framebuffer_fetchextension is only available to OpenGL ES 2.0 applications andprovides access to the framebuffer data as an input to your fragment shader.

These extensions are available on all devices capable of running iOS 6. As always, check for the existence ofan extension before using it in your application.

Media Player Framework

The MPVolumeViewclass now provides interfaces for customizing the appearance of the volume view. Youcan use these interfaces to change the images associated with the volume slider and routing button.

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

Image IO Framework

The Image IO framework (ImageIO.framework) includes support for accessing EXIF and IPTC metadataproperties for images. You can access this metadata using functions associated with theCGImageSourceRefandCGImageDestinationRefopaque types.

For information about the classes of the Image IO framework, seeImage I/O Reference Collection.

iAd Framework

The iAd framework (iAd.framework) supports a new medium rectangle banner size for ads on iPad devices.For information about the classes of the iAd framework, seeiAd Framework Reference.

Foundation Framework

The Foundation framework (Foundation.framework) includes the following enhancements:

The NSFileManagerclass includes theubiquityIdentityTokenmethod for determining the availabilityof iCloud, and theNSUbiquityIdentityDidChangeNotificationnotification for responding to auser logging into or out of iCloud, or changing accounts.

The NSUUIDclass helps you create objects that represent various types of UUIDs (Universally UniqueIdentifiers). For example, you can create anNSUUIDobject with RFC 4122 version 4 random bytes, or youcan base it on an existing UUID string.

The NSURLRequestclass lets you specify whether a request should be allowed to happen over a cellularnetwork.

The NSStringclass has new methods for converting a string to uppercase, lowercase, or an initial capitalcase.

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

External Accessory Framework

The External Accessory framework (ExternalAccessory.framework) includes new interfaces for managingconnections to Bluetooth devices. Apps can now post an alert panel that lists the Bluetooth devices availablefor pairing. Support is also provided for waking previously paired accessories that do not automatically connect.

For information about the classes of the External Accessory framework, seeExternal Accessory FrameworkReference.

Event Kit Framework

The Event Kit framework (EventKit.framework) includes the following enhancements:

The framework supports the creation of reminders; see“Reminders”(page 28).

Calendar and reminder events can now vend an external identifier that lets multiple devices refer to thesame event on the server. The server provides the actual identifier string, which is accessed using thecalendarItemExternalIdentifierproperty ofEKCalendarItem.

For apps linked against iOS 6 and later, the system asks for the user’s permission before granting accessto calendar and reminder data.

Apps can now cancel editing programmatically from anEKEventEditViewControllerobject.
For information about the classes of the Event Kit framework, see
Calendar and Reminders Programming Guide.

Core Video Framework

The Core Video framework (CoreVideo.framework) adds support for two new pixel formats. These formatsprovide efficient storage for one-channel and two-channel images that interoperate with OpenGL ES. Forinformation about the functions of the Core Video framework, seeCore Video Framework Reference.

Core Media Framework

The Core Media framework (CoreMedia.framework) adds the CMClockRefandCMTimebaseReftypes,which define fundamental media time service behaviors. For information about the functions of the Core Mediaframework, seeCore Media Framework Reference.

Core Location Framework

The Core Location framework (CoreLocation.framework) includes the following changes.

The CLLocationManagerobject now pauses the delivery of location events when the user has not movedfor an extended period of time. This behavior saves power by allowing the framework to turn off the GPSand other hardware. It is enabled by default but may be disabled by changing the value in thepausesLocationUpdatesAutomaticallyproperty of the location manager object.

You can refine location accuracy based on usage by assigning an appropriate value to theactivityTypeproperty ofCLLocationManager. This property currently lets you distinguish between driving usageand fitness usage.

The framework supports improved location accuracy while offline and driving.
For information about the classes of the Core Location framework, see
Core Location Framework Reference.

Core Bluetooth Framework

The Core Bluetooth framework (CoreBluetooth.framework) supports interacting with Bluetooth devicesin peripheral mode. Previously, an iOS device could only interact in central mode but it can advertise itself inperipheral mode and communicate with other iOS devices.

For information about the classes of the Core Bluetooth framework, seeCore Bluetooth Framework Reference.

Core Audio

Core Audio family of frameworks includes the following changes:

There is a new AUDeferredRenderer audio unit that allows audio to be processed on a lower-priority threadusing relatively larger time slices.

The AudioQueueProcessingTap audio unit allows you to intercept the data in an audio queue and processit.

For information about the audio technologies available in iOS, seeMultimedia Programming Guide. Forinformation about the new audio units, seeAudio Unit Component Services Reference.

AV Foundation Framework

The AV Foundation framework (AVFoundation.framework) includes the following enhancements:

The AVPlayerclass adds support for syncing playback to an external time source. A single player objectcan also play both HTTP Live Streams and file-based assets (including both local files and files that areprogressively downloaded). And you can use multipleAVPlayerLayerobjects to display the visual outputof the same player object.

The new AVPlayerItemOutputclass works with an AVPlayerItemobject to obtain decoded videoframes during playback so that your app can process them.

The AVAssetResourceLoaderclass allows you to insert a delegate object into the asset loading processand handle custom resource requests. This class works with theAVURLAssetclass.

The AVAudioSessionclass now exposes information about the current audio route in use.
The
AVAudioMixInputParametersclass provides access to anMTAudioProcessingTapRefdata type,

which can be used to access audio data before it is played, read, or exported.

The AVAudioSessionclass includes the following enhancements:
Use of an audio session delegate to detect interruptions and changes is now deprecated in favor of

a set of new notifications.

Audio sessions support a new audio category,AVAudioSessionCategoryMultiRoute, that allowsrouting of audio to and from multiple audio hardware devices.

Audio sessions support a new mode,AVAudioSessionModeMoviePlayback, that engagesappropriate output signal processing for movie playback scenarios.

The AVCaptureConnectionclass allows you to enable or disable support for video stabilization onincoming video.

The AVCaptureMetadataOutputclass is a new class for intercepting metadata emitted by a captureconnection object.

The AVMetadataFaceObjectis a new class that reports the face-detection data captured by anAVCaptureMetadataOutputobject.

The AVTextStyleRuleclass is a new class for specifying style options for subtitles, closed captions, andother text-related media assets.

The AVAudioPlayerclass can play audio items from the user’s iPod library using URLs obtained fromtheMPMediaLibraryclass. You can also set channel assignments using thechannelAssignmentsproperty.

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

Ad Support Framework

The Ad Support framework (AdSupport.framework) is a new framework that provides access to an identifierthat apps can use for advertising purposes. This framework also provides a flag that indicates whether the userhas opted out of ad tracking. Apps are required to read and honor the opt-out flag before trying to access theadvertising identifier.

For more information about this framework, seeAd Support Framework Reference.

Accelerate Framework

The Accelerate framework (Accelerate.framework) includes new vector-scalar power functions, vDSPfunctions, discrete cosine transform functions, SSE-related vector functions, sine functions, and vImage functions.

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

iOS 5.1

This article summarizes the key developer-related features introduced in iOS 5.1. This version of the operatingsystem runs on current iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.

For late-breaking news and information about known issues, seeiOS 5.1 Release Notes. For the complete listof new APIs added in iOS 5.1, seeiOS 5.1 API Diffs.

Dictation Support in Text Input Views

On supported devices, iOS automatically inserts recognized phrases into the current text view when the userhas chosen dictation input. The newUIDictationPhraseclass (declared in UITextInput.h) provides youwith a string representing a phrase that a user has dictated. In the case of ambiguous dictation results, thenew class provides an array containing alternative strings. New methods in theUITextInputprotocol allowyour app to respond to the completion of dictation.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.38

iOS 5.0

This article summarizes the key developer-related features introduced in iOS 5.0. This version of the operatingsystem runs on current iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.

For late-breaking news and information about known issues, seeiOS 5.0 Release Notes. For the complete listof new APIs added in iOS 5.0, seeiOS 5.0 API Diffs.

iCloud Storage APIs

The iCloud storage APIs let your app write user documents and data to a central location and access thoseitems from all of a user’s computers and iOS devices. Making a user’s documents ubiquitous using iCloudmeans that a user can view or edit those documents from any device without having to sync or transfer filesexplicitly. Storing documents in a user’s iCloud account also provides a layer of security for that user. Even ifa user loses a device, the documents on that device are not lost if they are in iCloud storage.

There are two ways that apps can take advantage of iCloud storage, each of which has a different intendedusage:

iCloud document storage—Use this feature to store user documents and data in the user’s iCloud account.iCloud key-value data storage—Use this feature to share small amounts of data among instances of your

app.

Most apps will use iCloud document storage to share documents from a user’s iCloud account. This is thefeature that users think of when they think of iCloud storage. A user cares about whether documents are sharedacross devices and can see and manage those documents from a given device. In contrast, the iCloud key-valuedata store is not something a user would see. It is a way for your app to share small amounts of data (up to aper-app total of 1 MB and a maximum of 1,024 keys) with other instances of itself. Apps can use this featureto store important state information. A magazine app might save the issue and page that the user read last,while a stocks app might store the stock symbols the user is tracking.

For information on how to use iCloud document and key-value data storage, seeiCloud Design Guide.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.39

iOS 5.0

iCloud Backup

iCloud Backup

Users can now opt to have their apps and app data backed up directly to their iCloud account, making it easierto restore apps to their most recent state. Having data backed up in iCloud makes it easy for a user to reinstallthat data to a new or existing iOS device. However, because the amount of space in a user’s iCloud account islimited, apps must be even more selective about where they store files.

The placement of files in your app’s home directory determines what gets backed up and what does not.Anything that would be backed up to a user’s computer is also backed up wirelessly to iCloud. Thus, everythingin the Documentsdirectory and most (but not all) of your app’sLibrarydirectory. To minimize the amountof data stored in the user’s iCloud account, developers are encouraged to put more files in theLibrary/Cachesdirectory, especially if those files can be easily re-created or obtained in another way.

Note:AnydocumentsthatyourappstoresexplicitlyiniCloud(usingtheiCloudstorageAPIs)arenot backed up with your app. (Those documents are already stored in the user’s iCloud account andtherefore do not need to be backed up separately.)

For information on which directories are backed up, and for information about iCloud document storage, seeiOS App Programming Guide.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.40

iOS 5.0

Automatic Reference Counting

Automatic Reference Counting

Automatic Reference Counting (ARC)is a compiler-level feature that simplifies the process of managing thelifetimes of Objective-C objects. Instead of you having to remember when to retain or release an object, ARCevaluates the lifetime requirements of your objects and automatically inserts the appropriate method calls atcompile time.

Reference counting manually

Automatic Reference Counting

retain/release code

{app_code}

retain/release code

{app_code}

retain/release code

{app_code}

retain/release code

{app_code}

retain/release code

{app_code}

retain/release code

{app_code}

{app_code}

{app_code}

{app_code}

{app_code}

Time
to produce

Time
to produce

To be able to deliver these features, ARC imposes some restrictions—primarily enforcing some best practicesand disallowing some other practices:

Do not call the retain,release,autorelease, ordeallocmethods in your code.

In addition, you cannot implement customretainorreleasemethods.

Because you do not call thereleasemethod, there is often no need to implement a customdeallocmethod—the compiler synthesizes all that is required to relinquish ownership of instance variables. Youcan provide a custom implementation ofdeallocif you need to manage other resources.

Do not store object pointers in C structures.
Store object pointers in other objects instead of in C structures.
Do not directly cast between object and nonobject types (for example, between
idandvoid*).

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.41

iOS 5.0

Automatic Reference Counting

You must use special functions or casts that tell the compiler about an object’s lifetime. You use these tocast between Objective-C objects and Core Foundation objects.

You cannot use NSAutoreleasePoolobjects.
Instead, you must use a new
@autoreleasepoolkeyword to mark the start of an autorelease block. The

contents of the block are enclosed by curly braces, as shown in the following example:

@autoreleasepool
{
   // Your code here
}

ARC encourages you to think in terms of object graphs, and the relationships between objects, rather than interms of retain and release. For this reason, ARC introduces new lifetime qualifiers for objects, including zeroingweak references. The value of a zeroing weak reference is automatically set tonilif the object to which itpoints is deallocated. There are qualifiers for variables, and newweakandstrongdeclared property attributes,as illustrated in the following examples:

// The following declaration is a synonym for: @property(retain) MyClass *myObject;@property(strong) MyClass *myObject;

// The following declaration is similar to "@property(assign) MyOtherClass
*delegate;"
// except that if the MyOtherClass instance is deallocated,
// the property value is set to nil instead of remaining as a dangling pointer
@property(weak) MyOtherClass *delegate;

Xcode provides migration tools to help convert existing projects to use ARC. For more information about howto perform this migration, seeWhat's New in Xcode. For more information about ARC itself, seeTransitioningto ARC Release Notes.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.42

iOS 5.0

Storyboards

Storyboards

Storyboards are the new way to define your app’s user interface. In the past, you used nib files to define youruser interface one view controller at a time. A storyboard file captures your entire user interface in one placeand lets you define both the individual view controllers and the transitions between those view controllers.As a result, storyboards capture the flow of your overall user interface in addition to the content you present.

If you are creating new apps, the Xcode templates come preconfigured to use storyboards. For other apps,the process for using storyboards is as follows:

  1. Configure your app’s Info.plistfile to use storyboards:

    Add the UIMainStoryboardFilekey and set its value to the name of your storyboard file.

    Remove the existing NSMainNibFilekey. (Storyboards replace the main nib file.)

  2. Create and configure the storyboard file in Xcode; see“Creating Storyboard Files”(page 43).

  3. Update your view controllers to handle storyboard transitions; see“Preparing to Transition to a New ViewController”(page 44).

  4. If you ever need to present a view controller manually (perhaps to support motion-related events), usethe storyboard classes to retrieve and present the appropriate view controller; see“Presenting StoryboardView Controllers Programmatically”(page 44).

Apps can use a single storyboard file to store all of their view controllers and views. At build time, InterfaceBuilder takes the contents of the storyboard file and divides it up into discrete pieces that can be loadedindividually for better performance. Your app never needs to manipulate these pieces directly, though. All youmust do is declare the main storyboard in your app’sInfo.plistfile. UIKit handles the rest.

Creating Storyboard Files

You use Interface Builder to create storyboard files for your app. Most apps need only one storyboard file, butyou can create multiple storyboard files if you want. Every storyboard file has a view controller known as theinitial view controller. This view controller represents the entry point into the storyboard. For example, inyour app’s main storyboard file, the initial view controller would be the first view controller presented by yourapp.

Each view controller in a storyboard file manages a single scene. For iPhone apps, ascenemanages one screen’sworth of content, but for iPad apps the content from multiple scenes can be on screen simultaneously. To addnew scenes to your storyboard file, drag a view controller from the library to the storyboard canvas. You canthen add controls and views to the view controller’s view just as you would for a nib file. And as before, youcan configure outlets and actions between your view controller and its views.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.43

iOS 5.0

Storyboards

When you want to transition from one view controller to another, Control-click a button, table view cell, orother trigger object in one view controller, and drag to the view controller for a different scene. Draggingbetween view controllers creates a segue, which appears in Interface Builder as a configurable object. Seguessupport all of the same types of transitions available in UIKit, such as modal transitions and navigation transitions.You can also define custom transitions and transitions that replace one view controller with another.

For more information about using Interface Builder to configure your storyboard files, seeWhat's New in Xcode.

Preparing to Transition to a New View Controller

Whenever a user triggers a segue in the current scene, the storyboard runtime calls theprepareForSegue:sender:method of the current view controller. This method gives the current viewcontroller an opportunity to pass any needed data to the view controller that is about to be displayed. Whenimplementing your view controller classes, you should override this method and use it to handle thesetransitions.

For more information about implementing the methods of theUIViewControllerclass, see UIViewControllerClass Reference.

Presenting Storyboard View Controllers Programmatically

Although the storyboard runtime usually handles transitions between view controllers, you can also triggersegues programmatically from your code. You might do so when it is not possible to set up the segue entirelyin Interface Builder—for example, when doing so involves using accelerometer events to trigger the transition.There are several options for transitioning to a new view controller:

If a storyboard file contains an existing segue between the current view controller and the destinationview controller (perhaps triggered by some other control in the view controller), you can trigger that segueprogrammatically using the performSegueWithIdentifier:sender:method ofUIViewController.

If there is no segue between the view controllers but the destination view controller is defined in thestoryboard file, first load the view controller programmatically using theinstantiateViewControllerWithIdentifier:method of UIStoryboard. Then present the viewcontroller using any of the existing programmatic means, such as by pushing it on a navigation stack.

If the destination view controller is not in the storyboard file, create it programmatically and present it asdescribed inView Controller Programming Guide for iOS.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.44

iOS 5.0

Newsstand Support

Newsstand Support

Newsstand provides a central place for users to read magazines and newspapers. Publishers who want todeliver their magazine and newspaper content through Newsstand can create their own iOS apps using theNewsstand Kit framework (NewsstandKit.framework), although doing so is not required. A big advantageof the Newsstand Kit framework, however, is that you can use it to initiate background downloads of newmagazine and newspaper issues. After you start a download, the system handles the download operation andnotifies your app when the new content is available.

Unlike other iOS apps, Newsstand apps appears only in Newsstand itself, not in a user’s Home screen. Andinstead of displaying an app icon, the app typically displays the cover of their most recent issue, with someadditional adornments provided by Newsstand. When the user taps that cover art, your app launches normallyto present the current issue or any back issues that were downloaded and are still available.

Note:NewsstandappsmustincludetheUINewsstandAppkeyintheirInfo.plistfiletoindicatethat they support Newsstand. For more information about this key, see Information Property List KeyReference.

Creating an app that uses Newsstand Kit requires some interplay between the actual app and the contentservers that you manage. Your servers are responsible for notifying the app when new content is available,typically using a push notification. If your Newsstand app includes the UIBackgroundModeskey with thenewsstand-contentvalue in itsInfo.plistfile, your Newsstand app is launched in the background sothat it can start downloading the latest issue. The download process itself is managed by the system, whichnotifies your app when the content is fully downloaded and available.

When your server is alerting your app of a new issue, that server should include thecontent-availableproperty (with a value of1) in the JSON payload. This property tells the system that it should launch your appso that it can begin downloading the new issue. Apps are launched and alerted to new issues once in a 24-hourperiod at most, although if your app is running when the notification arrives, it can begin downloading thecontent immediately.

In addition to your server providing content for each new issue, it should also provide cover art to present inNewsstand when that issue is available. This cover art is displayed in place of the app’s default icon, which isspecified by the Newsstand-specific icons in the CFBundleIconskey of your app’s Info.plistfile. Coverart gives users a more visual cue that a new issue is available. Your app can also add a badge to new issues.

For information about the classes you use to manage Newsstand downloads, seeNewsstand Kit FrameworkReference. For information about how to use push notifications to notify your apps, seeLocal and PushNotification Programming Guide. For more information about setting up Newsstand subscriptions, seeIn-AppPurchase Programming Guide.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.45

iOS 5.0

AirPlay Improvements

AirPlay Improvements

AirPlay lets users stream audio and video from an iOS-based device to AirPlay–enabled devices such as televisionsand audio systems. In iOS 5, developers can now use AirPlay to present app content on a nearby Apple TV 2.Users can now mirror the content of an iPad 2 to an Apple TV using AirPlay for any app. And developers whowant to display different content (instead of mirroring) can assign a new window object to anyUIScreenobjects connected to an iPad 2 via AirPlay.

In addition, you can now take advantage of AirPlay in the following ways:

Apps that use AV Foundation can now use theAVPlayerclass to stream audio and video content overAirPlay; seeAV Foundation Framework Reference.

The Media Player framework includes support for displaying “Now Playing” information in several locations,including as part of the content delivered over AirPlay; seeMPNowPlayingInfoCenter Class Reference.

The UIWebViewclass now supports the presentation of multimedia content over AirPlay. This support isenabled by default, but you can opt out of it if you want to.

Note:IniOS5,AirPlayisenabledbydefaultforallobjectsthatsupportit.Ifyoudonotwantyourapp’s content to be playable over AirPlay, you must opt out explicitly.

For more information about delivering content over AirPlay, and the support media formats, seeAirPlayOverview.

New Frameworks

In iOS 5.0, there are several new frameworks you should investigate.

GLKit Framework

The GLKit framework (GLKit.framework) contains a set of Objective-C based utility classes that simplify theeffort required to create an OpenGL ES 2.0 app. GLKit provides support for four key areas of app development:

The GLKViewandGLKViewControllerclasses provide a standard implementation of an OpenGLES–enabled view and associated rendering loop. The view manages the underlying framebuffer object onbehalf of the app; your app just draws to it.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.46

iOS 5.0

New Frameworks

The GLKTextureLoaderclass provides image conversion and loading routines to your app, allowing itto automatically load texture images into your context. It can load textures synchronously or asynchronously.When loading textures asynchronously, your app provides a completion handler block to be called whenthe texture is loaded into your context.

The GLKit framework provides implementations of vector, matrix, and quaternions as well as a matrix stackoperation to provide the same functionality found in OpenGL ES 1.1.

The GLKBaseEffect,GLKSkyboxEffect, andGLKReflectionMapEffectclasses provide configurablegraphics shaders that implement commonly used graphics operations. In particular, theGLKBaseEffectclass implements the lighting and material model found in the OpenGL ES 1.1 specification, simplifyingthe effort required to migrate an app from OpenGL ES 1.1 to OpenGL ES 2.0.

For information about the classes of the GLKit framework, seeGLKit Framework Reference.

Core Image Framework

The Core Image framework (CoreImage.framework) provides a powerful set of built-in filters for manipulatingvideo and still images. You can use the built-in filters for everything from simple operations (like touching upand correcting photos) to more advanced operations (like face and feature detection). The advantage of usingthese filters is that they operate in a nondestructive manner so that your original images are never changeddirectly. In addition, Core Image takes advantage of the available CPU and GPU processing power to ensurethat operations are fast and efficient.

The CIImageclass provides access to a standard set of filters that you can use to improve the quality of aphotograph. To create other types of filters, you can create and configure aCIFilterobject for the appropriatefilter type.

For information about the classes and filters of the Core Image framework, seeCore Image Reference Collection.

Twitter Framework

The Twitter framework (Twitter.framework) provides support for sending Twitter requests on behalf of theuser and for composing and sending tweets. For requests, the framework handles the user authentication partof the request for you and provides a template for creating the HTTP portion of the request. (Refer to theTwitter API for populating the content of the request.) The composition of tweets is accomplished using theTWTweetComposeViewControllerclass, which is a view controller that you post with your proposed tweetcontent. This class gives the user a chance to edit or modify the tweet before sending it.

Users control whether an app is allowed to communicate with Twitter on their behalf using Settings. TheTwitter framework also works in conjunction with the Accounts framework (Accounts.framework) to accessthe user’s account.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.47

iOS 5.0

App Design-Level Improvements

For information about the classes of the Twitter framework, seeTwitter Framework Reference. For informationabout the Accounts framework, see“Accounts Framework”(page 48).

Accounts Framework

The Accounts framework (Accounts.framework) provides a single sign-on model for certain user accounts.Single sign-on improves the user experience, because apps no longer need to prompt a user separately forlogin information related to an account. It also simplifies the development model for you by managing theaccount authorization process for your app. In iOS 5.0, apps can use this framework in conjunction with theTwitter framework to access a user’s Twitter account.

For more information about the classes of the Accounts framework, seeAccounts Framework Reference.

Generic Security Services Framework

The Generic Security Services framework (GSS.framework) provides a standard set of security-related servicesto iOS apps. The basic interfaces of this framework are specified in IETFRFC 2743andRFC 4401. In addition tooffering the standard interfaces, iOS includes some additions for managing credentials that are not specifiedby the standard but that are required by many apps.

For information about the interfaces of the GSS framework, see the header files.

Core Bluetooth

The Core Bluetooth framework (CoreBluetooth.framework) allows developers to interact specifically withBluetooth Low-Energy ("LE") accessories. The Objective-C interfaces of this framework allow you to scan for LEaccessories, connect and disconnect to ones you find, read and write attributes within a service, register forservice and attribute change notifications, and much more.

For more information about the interfaces of the Core Bluetooth framework, see the header files.

App Design-Level Improvements

The following sections describe new capabilities that you can incorporate into the model, view, and controllerlayers of your app.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.48

iOS 5.0

App Design-Level Improvements

Document Support

Cocoa Touch now includes aUIDocumentclass for managing the data associated with user documents. If youare implementing a document-based app, this class reduces the amount of work you must do to manage yourdocument data. In addition to providing a container for all of your document-related data, theUIDocumentclass provides built-in support for a number of features:

Asynchronous reading and writing of data on a background queue, allowing your app to remain responsiveto users while reading and writing operations occur.

Support for coordinated reading and writing of documents, which is required for documents in iCloudstorage.

Safe saving of document data by writing data first to a temporary file and then replacing the currentdocument file with it.

Support for resolving conflicts between different versions of your document if a conflict occurs.

Automatic saving of document data at opportune moments.

Support for flat file and package file representations on disk.

For apps that use Core Data to manage their content, there is also aUIManagedDocumentsubclass tomanage interactions with documents in the database.

If you are implementing an app that supports iCloud storage, the use of document objects makes the job ofstoring files in iCloud much easier. Document objects are file presenters and handle many of iCloud-relatednotifications that you might otherwise have to handle yourself. For more information about supporting iCloudstorage, see“iCloud Storage APIs”(page 39).

For information about the UIDocumentclass, seeUIDocument Class Reference. For information about theUIManagedDocumentclass, see UIManagedDocument Class Reference.

Data Protection Improvements

Introduced in iOS 4.0, data protection lets you store app and user data files on disk in an encrypted format sothat they can be accessed only when a user’s device is unlocked. In iOS 5.0, you now have more flexibilityregarding when your app can access protected files.

Using the NSFileProtectionCompleteUnlessOpenoption, your app can access a file while the deviceis unlocked and, if you keep the file open, continue to access that file after the user locks the device.

Using the NSFileProtectionCompleteUntilFirstUserAuthenticationoption, your app cannotaccess the file while the device is booting or until the user unlocks the device. After the user unlocks thedevice for the first time, you can access the file even if the user subsequently locks the device again.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.49

iOS 5.0

App Design-Level Improvements

You should protect files as soon as possible after creating them. For information about how to protect files,seeiOS App Programming Guide.

Custom Appearance for UIKit Controls

You can now customize the appearance of many UIKit views and controls to give your app a unique look andfeel. For example, you might use these customizations to make the standard system controls match the brandingfor the rest of your app.

UIKit supports the following customizations:

You can set the tint color, background image, and title position properties (among other) on a wide varietyof objects, including toolbars, navigation bars, search bars, buttons, sliders, and some other controls.

You can set attributes of some objects directly, or you can set the default attributes to use for a class usingan appearance proxy.

An appearance proxy is an object you use to modify the default appearance of visual objects such as viewsand bar items. Classes that adopt theUIAppearanceprotocol support the use of an appearance proxy.To modify the default appearance of such a class, retrieve its proxy object using theappearanceclassmethod and call the returned object’s methods to set new default values. A proxy object implementsthose methods and properties from its proxied class that are tagged with theUI_APPEARANCE_SELECTORmacro. For example, you can use a proxy object to change the default tint color (through theprogressTintColorortrackTintColorproperties) of theUIProgressViewclass.

If you want to set a different default appearance based on how a given object is used in your app, youcan do so using the proxy object returned by theappearanceWhenContainedIn:method instead. Forexample, you use this proxy object to set specific default values for a button only when it is containedinside a navigation bar.

Any changes you make with a proxy object are applied, at view layout time, to all instances of the classthat exist or that are subsequently created. However, you can still override the proxy defaults later usingthe methods and properties of a given instance.

For information about the methods for customizing the appearance of a class, see the description of that classinUIKit Framework Reference.

Container View Controller Support

The UIViewControllerclass now allows you to define your own custom container view controllers andpresent content in new and interesting ways. Examples of existing container view controllers includeUINavigationController,UITabBarController, andUISplitViewController. These view controllers

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.50

iOS 5.0

Xcode Tools

mix custom content with content provided by one or more separate view controller objects to create a uniquepresentation for app content. Container view controllers act as a parent for their contained view controllers,forwarding important messages about rotations and other relevant events to their children.

For more information about view controllers and the methods you need to implement for container viewcontrollers, seeUIViewController Class Reference.

Settings

Apps that deliver custom preferences can now use a new radio group element. This element is similar to themultivalue element for selecting one item from a list of choices. The difference is that the radio group elementdisplays its choices inline with your preferences instead of on a separate page.

For more information about displaying app preferences using the Settings app, see “App-Related Resources”iniOS App Programming Guide. For information about the property-list keys you use to build your Settingsbundle, seeSettings Application Schema Reference.

Xcode Tools

The following sections describe the improvements to the Xcode tools and the support for developing iOS apps.For detailed information about the features available in Xcode 4.2, seeWhat's New in Xcode.

Xcode Improvements

Xcode 4.2 adds support for many features that are available in iOS 5.0.

The LLVM compiler supports Automatic Reference Counting (ARC), and Xcode includes a menu item toconvert targets to use ARC. (For more information about ARC and about how to use it in your apps, see“Automatic Reference Counting” (page 41).)

The Interface Builder user interface provides support for creating storyboard files for your iOS apps. (Formore information about using storyboards in your iOS apps, see“Storyboards”(page 43).)

In iOS Simulator, you can now simulate different locations for apps using the Core Location framework.

You can download your app data from an iOS device and automatically restore that data when debuggingor testing in iOS simulator or on a device.

OpenGL ES Debugging

The debugging experience in Xcode has been updated to include a new workflow for debugging OpenGL ESapps. You can now use Xcode to do the following for your OpenGL ES apps:

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.51

iOS 5.0

Xcode Tools

Introspect OpenGL ES state information and objects such as view textures, shaders, and so on.

Set breakpoints on OpenGL ES errors, set conditional OpenGL ES entry point breakpoints, break on frameboundaries, and so on.

UI Automation Enhancements

The Automation instrument now includes a script editor and the ability to capture (record) actions into yourscript as you perform them on a device. There are also enhancements to the objects that you use in theAutomation instrument to automate UI testing:

The UIATargetobject can now simulate rotate gestures and location changes.

The UIAHostobject supports executing a task from the Instruments app itself.

The UIAElementobject can now simulate a rotate gesture centered on the element.

Several functions that were previously available only inUIAWindowandUIAPopoverwere moved toUIAElementbecause they are common to all element objects.

The UIAKeyboardobject now supports performing a sequence of keyboard taps to simulate the typingof a string.

For information about the enhancements to the Automation instrument, seeInstruments New Features UserGuide. For information about the JavaScript objects and commands that you use in your scripts, seeUIAutomation JavaScript Reference.

Instruments

The Instruments app in Xcode 4.2 adds several new instruments for iOS developers:

System Trace for iOS—Uses several instruments to profile aspects of Mac OS X or iOS that could be affectingapp performance, such as system calls, thread scheduling, and VM operations.

Network Connections instrument—Inspect how your app is using TCP/IP and UDP/IP connections. Withthis instrument it is possible to see how much data is flowing through each connection and for each app.You can also use it to display interesting statistics, such as round trip times and retransmission requestinformation.

Network Activity (located in Energy Diagnostics)—Helps bridge the gap between networking (cellular andWiFi) and energy usage. You use it to display device-wide data flow through each network interfacealongside energy usage level data that is taken directly from the battery.

For information about using these new instruments, seeInstruments New Features User Guide

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.52

iOS 5.0

Additional Framework Enhancements

Additional Framework Enhancements

In addition to the items discussed in the preceding sections, the following frameworks have additionalenhancements. For a complete list of new interfaces, seeiOS 5.0 API Diffs .

UIKit

The UIKit framework (UIKit.framework) includes the following enhancements:

The UIViewControllerclass can now be used to create custom container view controllers; see“ContainerView Controller Support”(page 50).

The UIKit framework provides support for loading and using storyboards; see“Storyboards”(page 43).Bars and bar button items can now be tinted and customized for your app; see“Custom Appearance for

UIKit Controls”(page 50).
The
UIPageViewControllerclass is a new container view controller for creating page-turn transitions

between view controllers.

The UIReferenceLibraryViewControllerclass adds support for presenting a custom dictionaryservice to the user.

The UIImagePickerControllerclass supports new options for specifying the quality of video recordings.TheUIStepperclass is a new control for incrementing a floating-point value value up or down within a

configurable range.
View-based animations now support cross-dissolve, flip-from-top, and flip-from-bottom animations; see

UIView Class Reference.
The
UIApplicationclass now reports the language directionality of the running app.

The UITableViewclass adds support for automatic row animations, moving rows and sections,multiselection, and copy and paste behaviors for cells.

The UIScreenclass lets you specify overscan compensation behaviors for video delivered over AirPlayor through an attached HDMI cable. You can also programmatically set a screen’s brightness.

The UIScrollViewclass now exposes its gesture recognizers so that you can configure them moreprecisely for your app.

The UISegmentedControlclass now supports proportional segment widths.
The
UIAlertViewclass now supports password-style text entry and special configurations for entering

text securely.
The
UIColorclass includes support for Core Image and new methods to retrieve individual color values.

The UIImageclass includes support for Core Image, support for stretching an image by tiling part of itscontent, and support for looping animations.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.53

iOS 5.0

Additional Framework Enhancements

The UITextInputTraitsprotocol adds support for a Twitter-specific keyboard and separate spell-checkingbehavior.

The UIAccessibilityprotocol includes new interfaces that define the activation point within an elementand indicate whether an element is modal or contains hidden elements. There are also new notificationsthat inform you of changes in system-provided accessibility features, such as zoom, audio status, andclosed captioning.

The UIAccessibilityReadingContentprotocol allows you to provide a continuous, page-turningreading experience to VoiceOver users.

The UIAccessibilityIdentificationprotocol allows you to uniquely identify elements in your appso that you can refer to them in automation scripts.

The UIWebViewclass automatically supports the presentation of multimedia content over AirPlay. Youcan opt out of this behavior by changing the value in themediaPlaybackAllowsAirPlayproperty ofthe class. This class also exposes ascrollViewproperty so that you can access the scrolling propertiesof your web interfaces.

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

OpenGL ES

OpenGL ES (OpenGLES.framework) now includes the following new extensions:

The EXT_debug_labelandEXT_debug_markerextensions allow you to annotate your OpenGL ES drawingcode with information specific to your app. The OpenGL ES Performance Detective, the OpenGL ESDebugger, and the OpenGL ES Analyzer tools provided by Xcode all take advantage of these annotations.

The EXT_color_buffer_half_floatextension allows 16-bit floating point formats to be specified for a framebuffer's color renderbuffer.

The EXT_occlusion_query_booleanextension allows your app to determine whether any pixels would bedrawn by a primitive or by a group of primitives.

The EXT_separate_shader_objectsextension allows your app to specify separate vertex and fragmentshader programs.

The EXT_shadow_samplersextension provides support for shadow maps.
The
EXT_texture_rgextension adds one-component and two-component texture formats suitable for use

in programmable shaders.
As always, check for the existence of an extension before using it in your app.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.54

iOS 5.0

Additional Framework Enhancements

OpenAL

The OpenAL framework (OpenAL.framework) has two significant extensions:

You can get notifications about source state changes and changes regarding the number of audio buffersthat have been processed.

The Apple Spatial Audio extension in iOS 5.0 adds three audio effects that are especially useful for games:reverberation, obstruction effects, and occlusion effects.

For information about the OpenAL interfaces, see the header files.

Message UI

The Message UI framework (MessageUI.framework) adds a new notification for tracking changes to thedevice’s ability to send text messages. For information about the interfaces of the Message UI framework, seeMessage UI Framework Reference.

Media Player

The Media Player framework (MediaPlayer.framework) includes the following enhancements:

There is now support for displaying “Now Playing” information in the lock screen and multitasking controls.This information can also be displayed on an Apple TV and with content delivered via AirPlay.

You can detect whether video is being streamed to an AirPlay device using theairPlayVideoActiveproperty of theMPMoviePlayerControllerclass.

Apps can now use the framework to play content from iTunes University.
For information about the classes in the Media Player framework, see
Media Player Framework Reference.

Map Kit

The Map Kit framework (MapKit.framework) supports the ability to use heading data to rotate a map basedon the user’s current orientation. As you can with the Maps app, you can configure your map view to scrollthe map according to the user’s current location. For example, a walking tour app might use this to show theuser their current location on the tour.

For information on the interfaces you use to implement map scrolling and rotation, seeMap Kit FrameworkReference.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.55

iOS 5.0

Additional Framework Enhancements

Note:IfyouarecurrentlyusingMapKitforgeocoding,youshouldswitchtousingtheCoreLocationframework for that feature; see“Core Location”(page 58).

iAd

The iAd framework (iAd.framework) provides new callback methods for developers who use multiple adnetworks and want to be notified when a new ad is available. ThebannerViewWillLoadAd:method (definedin the ADBannerViewDelegateprotocol) is called when a banner has confirmed that an ad is available butbefore the ad is fully downloaded and ready to be presented. TheinterstitialAdWillLoad:method(defined in the ADInterstitialAdDelegateprotocol) offers similar behavior for interstitial ads.

For information about the classes of the iAd framework, seeiAd Framework Reference.

Game Kit

The Game Kit framework (GameKit.framework) and Game Center now have the following features:

The GKTurnBasedMatchclass provides support for turn-based gaming, which allows games to createpersistent matches whose state is stored in iCloud. Your game manages the state information for thematch and determines which player must act to advance the state of the match.

Your game can now adjust the default leaderboard (implemented by theGKLeaderboardclass) shownto each player. If your game does not change the default leaderboard for a player, that player sees theleaderboard configured for your app in iTunes Connect.

The GKNotificationBannerclass implements a customizable banner similar to the banner shown toplayers when they log in to Game Center. Your game may use this banner to display messages to theplayer.

When your game reports an achievement, it can automatically display a banner to the player using theGKAchievementclass.

A GKMatchmakerViewControllerobject can now add players to an existing match in addition tocreating a new match.

The GKMatchDelegateprotocol now includes a method to reconnect devices when a two-player matchis disconnected.

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

Foundation

The Foundation framework (Foundation.framework) includes the following enhancements:

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.56

iOS 5.0

Additional Framework Enhancements

The NSFileManagerclass includes new methods for moving a file to a user’s iCloud storage.
The new
NSFileCoordinatorclass andNSFilePresenterprotocol implement now locking support

and notifications when manipulating documents in iCloud.
The new
NSFileVersionclass reports and manages conflicts between different versions of a file in iCloud.TheNSURLclass includes new methods and constants to support syncing items to a user’s iCloud storage.

The new NSMetadataQueryclass supports attributes for items synced to a user’s iCloud storage. Severalother metadata-related classes were also added, includingNSMetadataItem,NSMetadataQueryResultGroup, and NSMetadataQueryAttributeValueTuple.

The new NSJSONSerializationclass is a new class that supports back-and-forth conversions betweenJSON dataand Foundation types.

The new NSLinguisticTaggerclass is a new class lets you break down a sentence into its grammaticalcomponents, allowing the determination of nouns, verbs, adverbs, and so on. This tagging works fully forEnglish and the class also provides a method to find out what capabilities are available for other languages.

This framework now includes theNSFileWrapperclass for managing file packages—that is, filesimplemented as an opaque directory.

The new NSOrderedSetcollection class offers the semantics of sets, whereby each element occurs atmost once in the collection, but where elements are in a specific order.

Most delegate methods are now declared using formal protocols instead of as categories onNSObject.For information about the classes of the Foundation framework, seeFoundation Framework Reference.

External Accessory

Apps that use the External Accessory framework to communicate with external accessories can now ask to bewoken up if the app is suspended when its accessory delivers new data. Including theUIBackgroundModeskey with theexternal-accessoryvalue in your app’sInfo.plistfile keeps your accessory sessions openeven when your app is suspended. (Prior to iOS 5, these sessions were closed automatically at suspend time.)When new data arrives for a given session, a suspended app is woken up and given time to process the newdata. This type of behavior is designed for apps that work with heart-rate monitors and other types of accessoriesthat need to deliver data at regular intervals.

For more information about theUIBackgroundModeskey, see Information Property List Key Reference. Forinformation about interacting with external accessories, seeExternal Accessory Programming Topics.

Event Kit and Event Kit UI

The Event Kit framework (EventKit.framework) includes the following enhancements:

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.57

iOS 5.0

Additional Framework Enhancements

The class hierarchy has been restructured. There is now a common base class calledEKObjectand portionsof the EKEventclass have been moved into a new base class calledEKCalendarItem.

With the EKEventStoreclass, you can now create and delete calendars programmatically, fetch calendarsbased on their identifier, save and remove events in batches, and trigger a programmatic refresh of calendardata.

The new EKSourceclass represents the source for creating new calendars and events.
The
EKCalendarclass now provides access to a calendar’s UUID, source, and other attributes.

The Event Kit UI framework (EventKitUI.framework) now includes the EKCalendarChooserclass, whichprovides a standard way for selecting from the user’s iCal calendars.

For information about the classes of the Event Kit framework, seeEvent Kit Framework Reference. For informationabout the classes of the Event Kit UI framework, seeEvent Kit UI Framework Reference.

Core Motion

The Core Motion framework (CoreMotion.framework) now supports reporting heading information andmagnetometer data for devices that have the corresponding hardware.

For information about the classes of the Core Motion framework, seeCore Motion Framework Reference.

Core Location

The Core Location framework (CoreLocation.framework) now includes support for both forward andreverse geocoding location data. This support allows you to convert back and forth between a set of mapcoordinates and information about the street, city, country (and so on) at that coordinate.

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

Core Graphics

The Core Graphics framework (CoreGraphics.framework) includes some new interfaces to support thecreation of paths. Specifically, there are new interfaces for creating paths with an ellipse or rectangle and foradding arcs to existing paths.

For more information about the Core Graphics interfaces, seeCore Graphics Framework Reference.

Core Data

The Core Data framework includes the following enhancements:

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.58

iOS 5.0

Additional Framework Enhancements

Core Data provides integration with the iOS document architecture and iCloud storage. TheUIManagedDocumentclass is a concrete subclass ofUIDocumentthat uses a Core Data persistent storefor document data storage.

For apps built for iOS 5.0 or later, persistent stores now store data by default in an encrypted format ondisk. The default protection level prevents access to the data until after the user unlocks the device forthe first time. You can change the protection level by assigning a custom value to theNSPersistentStoreFileProtectionKeykey when configuring your persistent stores. For additionalinformation about the data protection that are new in iOS 5.0, see“Data Protection Improvements”(page49).

Core Data formalizes the concurrency model for theNSManagedObjectContextclass with new options.When you create a context, you can specify the concurrency pattern to use with it: thread confinement,a private dispatch queue, or the main dispatch queue. TheNSConfinementConcurrencyTypeoptionprovides the same behavior that was present on versions of iOS prior to 5.0 and is the default. Whensending messages to a context created with a queue association, you must use theperformBlock:orperformBlockAndWait:method if your code is not already executing on that queue (for the main queuetype) or within the scope of aperformBlock...invocation (for the private queue type). Within theblocks passed to those methods, you can use the methods ofNSManagedObjectContextfreely. TheperformBlockAndWait:method supports API reentrancy. TheperformBlock:method includes anautorelease pool and calls theprocessPendingChangesmethod upon completion.

You can create nested managed object contexts, in which the parent object store of a context is anothermanaged object context rather than the persistent store coordinator. This means that fetch and saveoperations are mediated by the parent context instead of by a coordinator. This pattern has a number ofusage scenarios, including performing background operations on a second thread or queue and managingdiscardable edits, such as in an inspector window or view

Nested contexts make it more important than ever that you adopt the “pass the baton” approach ofaccessing a context (by passing a context from one view controller to the next) rather than retrieving itdirectly from the app delegate.

Managed objects support two significant new features: ordered relationships, and external storage forattribute values. If you specify that the value of a managed object attribute may be stored as an externalrecord, Core Data heuristically decides on a per-value basis whether it should save the data directly in thedatabase or store a URI to a separate file that it manages for you.

There are two new classes,NSIncrementalStoreandNSIncrementalStoreNode, that you can useto implement support for nonatomic persistent stores. The store does not have to be a relationaldatabase—for example, you could use a web service as the back end.

For more details about the new features in Core Data, seeCore Data Release Notes for OS X v10.7 and iOS 5.0.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.59

iOS 5.0

Additional Framework Enhancements

Core Audio

The Core Audio family of frameworks includes the following changes in iOS 5.0:

Audio-session routing information is now specified using dictionary keys. There are also new modes formanaging your app’s audio behavior:

Voice chat mode optimizes the system for two-way voice conversation.
Video recording mode configures the device for video capture.
Measurement mode disables automatic compression and limiting for audio input.Default mode provides iOS 4.3.3 behavior.

For information about the audio technologies available in iOS, seeMultimedia Programming Guide. Forinformation about the new audio units, seeAudio Unit Component Services Reference.

AV Foundation

The AV Foundation framework includes the following enhancements:

There is automatic support for playing audio and video content over AirPlay. Apps can opt out oftransmitting video over AirPlay using theallowsAirPlayVideoproperty of the AVPlayerclass.

New properties on the AVPlayerItemclass indicate whether the item supports fast-forwarding orrewinding of the content.

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

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.60

Core Audio adds seven new audio units for handling advanced audio processing features in your app,such as reverb, adjustable equalization, and time compression and stretching. The new Sampler unit letsyou create music instruments, for which you can provide your own sounds. The new AUFilePlayer unit letsyou play sound files and feed them directly to other audio units.

The 3D Mixer audio unit is enhanced in iOS 5.0 to provide reverb and other effects useful in game audio.

You can automate audio unit parameters in an audio processing graph, which lets you build a music mixerthat remembers fader positions and changes.

You can now use the advanced features of Apple Core Audio Format files in iOS. For example, you mightcreate new voices for the Sampler audio unit.

There is now programmatic support for adjusting the audio input gain.
Core Audio now supports 32-bit floating-point audio data for apps that need to provide high quality audio.

iOS 5.0

Additional Framework Enhancements

Assets Library

The Assets Library framework includes the following enhancements:

Support for accessing photo streams
Support for creating new albums in the user’s photo librarySupport for adding assets to albums
The ability to get an aspect ratio thumbnail for an assetThe ability to modify saved assets

For information about the classes of the Assets Library framework, seeAssets Library Framework Reference.

Address Book

The Address Book framework adds support for importing and exporting vCard data. It also adds new keys toassociate social network affiliations with a user record.

For more information about the new features in the Address Book framework, seeAddress Book FrameworkReference for iOS.

Security

The Security framework (Security.framework) now includes the Secure Transport interfaces, which areApple’s implementation of the SSL/TLS protocols. You can use these interfaces to configure and manage SSLsessions, manage ciphers, and manage certificates.

For information about the Secure Transport interfaces, see theSecureTransport.hheader file of the Securityframework.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.61

iOS 4.3

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

For the latest updates and information, you should also seeiOS 4.3 Release Notes. For the complete list of newAPIs added in iOS 4.3, seeiOS 4.3 API Diffs.

AirPlay Video Support

Support for playing video using AirPlay is included in theMPMoviePlayerControllerclass. This supportallows you to play video-based content on AirPlay–enabled hardware such as Apple TV. When theallowsAirPlayproperty of an active MPMoviePlayerControllerobject is set toYESand the device is inrange of AirPlay–enabled hardware, the movie player presents the user with a control for sending the videoto that hardware. (That property is set toNOby default.) Supported formats include:

H.264 video with AAC audio
HTTP streaming, both live and on demandprogressive download content
local content

For web-based content, you can enable AirPlay Video in the QuickTime Plug-in or HTML5 video element asfollows:

       airplay="allow"

airplay="deny"(Default)

For example:

x-webkit-airplay="allow"x-webkit-airplay="deny"(Default)

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.62



QTPlug-in:

HTML5 video element:

iOS 4.3

Framework Enhancements

For example:

For more information about using theMPMoviePlayerControllerclass to play video, seeMPMoviePlayerController Class Reference.

Framework Enhancements

The following sections highlight the significant changes to frameworks and technologies in iOS 4.3. For acomplete list of all new interfaces available in the system, seeiOS 4.3 API Diffs .

AV Foundation

The AV Foundation framework includes the following enhancements:

The AV Foundation framework added theAVPlayerItem,AVPlayerItemAccessLogEvent, andAVPlayerItemErrorLogEventclasses for tracking network playback statistics.

The AVMetadataItemclass added support for loading key data asynchronously.
For information about the classes of the UIKit framework, see
AV Foundation Framework Reference.

Core Audio Frameworks

The Audio Unit and Audio Toolbox frameworks include the following enhancements:

The AudioUnitParameterHistoryInfostruct (in the Audio Unit framework) along with supportingaudio unit properties adds the ability to track and use parameter automation history.

The ExtendedAudioFormatInfostruct (in the Audio Toolbox framework) lets you specify which codecto use when accessing thekAudioFormatProperty_FormatListproperty.

The kAFInfoDictionary_SourceBitDepthdictionary key and thekAudioFilePropertySourceBitDepthproperty (in the Audio Toolbox framework) provide access tothe bit depth of an audio stream.

The kAudioConverterErr_NoHardwarePermissionresult code (in the Audio Toolbox framework)indicates that a request to create a new audio converter object cannot be satisfied because the applicationdoes not have permission to use the requested hardware codec.

For information about the functions and types of the Audio Unit framework, seeAudio Unit Framework Reference.For information about the functions and types of the Audio Toolbox framework, seeAudio Toolbox FrameworkReference.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.63

iOS 4.3

Framework Enhancements

iAd

The ADInterstitialAdclass is controller that you can use to present full-screen banners in your content.You present these banners in an existing view or as part of a transition from one page of content to another.For example, you might use this object to incorporate full-page ads into a page-based magazine layout.

For more information about the classes of the iAd framework, seeiAd Framework Reference.

Media Player

The Media Player framework includes the following enhancements:

The MPMoviePlayerControllerclass supports playback of video content using AirPlay; see“AirPlayVideo Support”(page 62).

The MPMovieAccessLog,MPMovieErrorLog,MPMovieAccessLogEvent, andMPMovieErrorLogEventclasses allow you to track network playback statistics.

The MPMoviePlayerControllerclass now includes properties for accessing log information.
For more information about the classes of the Media Player framework, see
Media Player Framework Reference.

UIKit

The UIViewControllerclass added thedisablesAutomaticKeyboardDismissalmethod, which youcan use to override the default input view dismissal behavior.

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

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.64

iOS 4.2

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

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

Printing

iOS now incorporates support for wireless printing from iPhone and iPad applications. For the most part, theobjects 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 printjobs on the printer.

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

Note:Wireless printing is available only on devices that support multitasking. You can use theUIPrintInteractionControllerobject to detect whether printing is available in your application.

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

An application can hand images or PDF content directly to UIKit and let it manage the printing of thoseitems.

An application can use print formatter objects to lay out specific types of content over multiple pages.UIKit provides print formatters for plain text, HTML text, and some system views (web views, text views,and map views).

An application can choose to render the content itself using a print page renderer object. This option givesyou the most control over your printed content but also lets you use print formatters to assist with thelayout of parts of your content.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.65

iOS 4.2

AirPlay

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

AirPlay

AirPlay is a technology that lets your application stream audio to Apple TV and to third-party AirPlay speakersand receivers. AirPlay support is built in to the AV Foundation framework and the Core Audio family offrameworks. Any audio content you play using these frameworks is automatically made eligible for AirPlaydistribution. 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, seeMultimedia Programming Guide.

Core MIDI

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 messagesand to interact with MIDI peripherals connected to an iOS-based device using the dock connector or network.

For more information about using this framework, seeCore 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 theavailability of Objective-C classes. System frameworks now tag their classes with availability information thatthe compiler can use to link weakly to those classes as needed. This new tagging mechanism simplifies thecode you need to use to do runtime checking for the availability of the class. Whereas previously, you neededto use theNSClassFromStringfunction to determine whether a class was present, now you can simplycheck for the existence the class directly using code similar to the following:

  if ([UIPrintInteractionController class])
  {
     // Create an instance of the class and use it.
  }

else{

     // The print interaction controller is not available.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.66

iOS 4.2

Framework Enhancements

}

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

Build your project using LLVM and Clang. (The standalone GCC compiler does not currently support thisfeature.)

Set your project’s deployment target to iOS 3.1 or later.

Change the linking option for each framework you want to link weakly. To do this, open an inspector foryour application target and go to the inspector’s General tab to view the list of frameworks and librarieslinked against the target. For frameworks you want to link weakly, change the value in the Type columnfrom Required to Weak.

If the deployment target for your application is set to a version of iOS that does not contain a givenframework (because it was introduced in a later version), set the link type of that framework to Weak. Formost other frameworks, you should leave the link type set to Required.

For information about how to perform runtime availability checks for classes and methods, seeSDK CompatibilityGuide.

Framework Enhancements

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

Core Location

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

Game Kit

The Game Kit framework includes a newGKFriendRequestComposeViewControllerclass, which you canpresent from your application and use to invite friends to play a game. For more information about how touse Game Kit in your application, seeGame Center Programming Guide.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.67

iOS 4.2

Framework Enhancements

iAd

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

Media Player

The Media Player framework includes the following enhancements:

The interface presented by theMPVolumeViewclass now includes a control for routing audio content toAirPlay–enabled devices.

The MPMediaItemandMPMediaItemCollectionclasses now descend from a common ancestor class:MPMediaEntity. This change in hierarchy allows you to create collections that include both items andother 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, seeMedia Player Framework Reference.

UIKit

The UIKit framework includes the following enhancements

New accessibility constants allow “scroll by page” capabilities using VoiceOver.
New classes to support printing; see
“Printing”(page 65)
The
UIDeviceclass now provides theplayInputClickmethod for playing the input-click sound directly.

Application delegates can now use theapplication:openURL:sourceApplication:annotation:method to receive information about URLs that are opened while the application is running in thebackground.

The UITextInputModeclass now exposes the language in use for inputting text.
The
UIDocumentInteractionControllerclass supports printing with the help of its delegate object.

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

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.68

iOS 4.1

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

Note:iOS4.1doesnotsupportiPad.ItrunsonlyoniPhoneandiPodtouchdevices.Youmustusea different version of the iOS SDK to develop iPad applications.

For the latest updates and information, you should also seeiOS 4.1 Release Notes. For the list of API differencesbetween the iOS 4.1 and earlier versions of iOS, seeiOS 4.1 API Diffs.

Game Center

Game Center is an extension to the Game Kit framework that provides support for the following features:

Aliases allow users to create their own online persona. Users log in to Game Center and interact with otherplayers anonymously through their alias. Players can set status messages as well as mark specific peopleas their friends.

Leaderboards allow your application to post user scores to Game Center and retrieve them later. Youmight use this feature to show the best scores among all users of your application.

Matchmaking allows you to create multiplayer games by connecting players who are logged into GameCenter. Players do not have to be local to each other to join a multiplayer game.

Achievements allows you to record the progress a player has made in your game.
The preceding features all contribute towards the experience users see in the Game Center application. For

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

Framework Enhancements

The following existing frameworks and technologies include additional incremental changes. For a completelist of new interfaces, seeiOS 4.1 API Diffs .

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.69

iOS 4.1

Framework Enhancements

AV Foundation

The AV Foundation framework includes the following enhancements:

A new AVQueuePlayerclass for playing a sequence ofAVPlayerItemobjects.
A new
AVAssetReaderclass for reading samples from media files.
A new
AVAssetWriterclass for writing samples to a data file and optionally compressing them.

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

Assets Library

The Assets Library framework includes new methods to save images to a user’s photo album. These newmethods are declared in theALAssetsLibraryclass.

Core Text

The Core Text framework includes new functions for managing fonts. For more information about the functionsavailable in the Core Text framework, seeCore Text Reference Collection.

System Configuration

The System Configuration framework contains new interfaces for identifying captive networks. For moreinformation about the functions available in the System Configuration framework, seeSystem ConfigurationFramework Reference.

UIKit

The UIKit framework includes the following enhancements:

Additional constants for theUIImagePickerControllerclass that allow you to obtain additionalinformation about an image.

A decimal keyboard type that you can use for text entry. You can specify this keyboard type using theUIKeyboardTypeDecimalPadconstant.

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

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.70

iOS 4.0

This article summarizes the developer-related features introduced in iOS 4. This version of the operating systemruns on iPhone and iPod touch only and does not run on iPad. In addition to describing the new features, thisarticle lists the documents that describe those features in more detail.

Note:iOS4doesnotsupportiPad.ItrunsonlyoniPhoneandiPodtouchdevices.Youmustuseadifferent version of the iOS SDK to develop iPad applications.

For the latest updates and information, you should also seeiOS 4.0 Release Notes. For the list of API differencesbetween the iOS 4 and earlier versions of iOS, seeiOS 4.0 API Diffs.

Multitasking

Applications built using iOS SDK 4 or later (and running in iOS 4 and later) are no longer terminated when theuser presses the Home button; instead, they now shift to a background execution context. For many applications,this means that the application enters a suspended state of execution shortly after entering the background.Keeping the application in memory avoids the subsequent launch cycle and allows an application to simplyreactivate itself, which improves the overall user experience. And suspending the application improves overallsystem performance by minimizing power usage and giving more execution time to the foreground application.

Although most applications are suspended shortly after moving to the background, applications that need tocontinue 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 not theapplication 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 exit

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.71

iOS 4.0

Integration Technologies

at any time. This means that many of the tasks you used to perform at quit time must now be performed whenyour application moves to the background. This requires implementing some new methods in your applicationdelegate to respond to application state transitions.

For more information on how to handle the new background state transitions, and for information on how tocontinue running in the background, seeiOS App Programming Guide.

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 have thosenotifications 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, seeLocal 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, seeEvent Kit Framework ReferenceandEvent Kit UI Framework Reference.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.72

iOS 4.0

Integration Technologies

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 motion asinput or as a way to enhance the overall user experience.

For more information about the classes and methods of this framework, see “Event Delivery: The ResponderChain” inEvent Handling Guide for iOS.

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 “App States andMultitasking” iniOS App 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, seeCore Telephony FrameworkReference.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.73

iOS 4.0

Graphics and Multimedia

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, seeiAd 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 or nomodifications. The coordinate values you specify during drawing or when manipulating views are all mappedto a logical coordinate system, which is decoupled from the underlying screen resolution. Any content youdraw is automatically scaled as needed to support high-resolution screens. For vector-based drawing code,the system frameworks automatically use any extra pixels to improve the crispness of your content. And if youuse images in your application, UIKit provides support for loading high-resolution variants of your existingimages automatically.

For detailed information about how to support high-resolution screens, see “Supporting High-ResolutionScreens In Views” inDrawing and Printing Guide for iOS.

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 obtaining thefile, you use the view controller provided by this framework to display the contents of that file directly in youruser interface.

For more information about the classes and methods of this framework, seeQuick Look Framework Referencefor iOS.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.74

iOS 4.0

Graphics and Multimedia

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 iOS 3.0, thisframework has been expanded in iOS 4 to include significant new capabilities, substantially broadening itsusage beyond basic audio playback and recording capabilities. Specifically, this framework now includes supportfor the following features:

Media asset managementMedia 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 iOS. Thisframework 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, seeAV FoundationFramework Reference.

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, seeAssets Library Framework Reference.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.75

iOS 4.0

Core Services

Image I/O

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

For more information about the functions and data types of this framework, seeImage I/O Reference Collection.

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, seeCore 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 and Objective-C code. Ablock object is essentially an anonymous function and the data that goes with that function, something whichin other languages is sometimes called a closureorlambda. Blocks are particularly useful as callbacks or inplaces where you need a way of easily combining both the code to be executed and the associated data.

In iOS, 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 operationsTo facilitate performing a task on all the items in a collection

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.76

iOS 4.0

Xcode Tools

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 more

information about blocks, seeBlocks Programming Topics.

Grand Central Dispatch

Grand Central Dispatch (GCD) is a BSD-level technology that you use to manage the execution of tasks in yourapplication. GCD combines an asynchronous programming model with a highly optimized core to provide aconvenient (and more efficient) alternative to threading. GCD also provides convenient alternatives for manytypes of low-level tasks, such as reading and writing file descriptors, implementing timers, monitoring signalsand process events, and more.

For more information about how to use GCD in your applications, seeConcurrency Programming Guide. Forinformation about specific GCD functions, seeGrand 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 iOS–based devices.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, seeAccelerate Framework Reference.

Xcode Tools

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

Xcode Improvements

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

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.77

iOS 4.0

Framework Enhancements

Note:You still need to log in to your team portal to create provisioning profiles with specificapplication IDs for in-app purchase and push notifications. However, once created, those provisioningprofiles will also be managed by Xcode if automatic device provisioning is enabled.

For more information about using Xcode, seeXcode Overview.

UI Automation API

The Instruments application now provides support for automating the testing of your iOS applications. Thebuilt-in Automation instrument works from scripts (written in JavaScript) that you provide to drive the simulationof events in your application. These synthetic events are generated with the help of the accessibility interfacesbuilt into iOS and integrated into all existing UIKit views. You can use this instrument to improve your testingprocess and deliver more robust applications.

For information about how to use the Automation instrument, seeInstruments User Guide. For informationabout the JavaScript objects and commands you use in your scripts, seeUI Automation JavaScript Reference.

Framework Enhancements

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

UIKit Framework Enhancements

The UIKit framework includes the following enhancements:

The UIApplicationclass andUIApplicationDelegateprotocol 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 UIImagePickerControllerclass 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.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.78

iOS 4.0

Framework Enhancements

The UILocalNotificationclass supports the configuration of local notifications; see“LocalNotifications”(page 72).

The UIViewclass includes new block-based methods for implementing animations.
The
UIWindowclass has a newrootViewControllerproperty that you can use to change the contents

of the window.

Media applications can now receive events related to the controls on an attached set of headphones. Youcan 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 UIAccessibilityActionprotocol makes it easy for VoiceOver users to adjust the value of UIelements, such as pickers and sliders.

UIPickerViewAccessibilityDelegateprotocol enables access to the individual componentsof a picker.

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

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

New interfaces in UIAccessibilityprotocol allow you to specify the language in which labels andhints are spoken, and provide announcements that describe events that don't update application UIin way that would be perceptible to VoiceOver users.

The UINibclass provides a way to instantiate multiple sets of objects efficiently from the same nib file.For information about the classes of the UIKit framework, seeUIKit 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 onNSObject.Block-based variants are now available for many types of operations.
There is new support for creating and formatting date information in
NSDateandNSDateFormatter.TheNSDateComponentsclass added support for specifying time zone and quarter information.

There is support for regular-expression matching using theNSRegularExpression,NSDataDetector,andNSTextCheckingResultclasses.

The NSBlockOperationclass allows you to add blocks to operation queues.
You can use the
NSFileManagerclass to mark files as protected; see“Data Protection”(page 73).

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.79

iOS 4.0

Framework Enhancements

The NSFileWrapperclass allows you to work with package-based document types.

The NSOrthographyclass describes the linguistic content of a piece of text.

The NSCacheclass 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, seeFoundation Framework Reference.

OpenGL ES Enhancements

The OpenGL ES framework includes the following enhancements:

The APPLE_framebuffer_multisampleextension enables full-scene anti-aliasing.
The
EXT_framebuffer_discardextension can be used to improve the performance of applications

that use depth buffers or multisample framebuffers.

The APPLE_texture_max_levelandEXT_shader_texture_lodextensions provide more controlover texture sampling.

The OES_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_textureextension enables rendering real-time shadows using shadow maps.

The OES_texture_float(http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt)andOES_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 with otherplayers anonymously through their alias. Players can set status messages as well as mark specific peopleas their friends.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.80

iOS 4.0

Framework Enhancements

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.

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

Core Location Enhancements

The Core Location framework now supports the following features:

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, seeCore Location Framework Reference.

Map Kit Enhancements

The Map Kit framework includes the following enhancements:

Support for draggable map annotationsSupport 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, seeMap Kit Framework Reference.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.81

Important:GameCenterisavailabletodevelopersonlyiniOS4.Itisintroducedasadeveloper-onlyfeatureso 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 iOS 4 and you should not deploy applications that use it tothe App Store.

iOS 4.0

Inherited Improvements

Message UI Enhancements

The Message UI framework includes a newMFMessageComposeViewControllerclass 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 and sendthe message entirely from within your application.

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

Core Graphics Enhancements

The Core Graphics framework includes the following enhancements:

The ability to embed metadata into PDF files using theCGPDFContextAddDocumentMetadatafunctionSupport 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, seeCore Graphics FrameworkReference.

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, iOS includes only the headersused to support regular expressions.

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

Inherited Improvements

Although iOS 3.2 does not run on iPhone and iPod touch devices, many of the features introduced in thatversion of the operating system are also supported in iOS 4. Specifically, iOS 4 supports:

Custom input viewsConnecting external displaysFile-sharing support
Gesture recognizers

2013-10-22

| Copyright © 2013 Apple Inc. All Rights Reserved.82

iOS 4.0

Inherited Improvements

Core Text for text layout and rendering
Text input through integration with the keyboardCustom fonts
ICU Regular Expressions
Document types
PDF generation
Xcode Tools changes
UIKit framework changes
Media Player framework changes
Core Animation changes
Foundation framework changes

2013-10-22

| Copyright © 2013 Apple Inc. All Rights Reserved.83

Document Revision History

This table describes the changes toWhat's New in iOS.

Date

Notes

2013-10-222013-09-182013-01-282012-09-25

2012-09-19

2012-03-072011-10-122011-02-282010-11-152010-08-172010-07-082010-06-042010-03-24

Updated the web links for OpenGL ES extensions added in iOS 7.

Added information about new features in iOS 7.

Added new features introduced in iOS 6.1.

The links to the OpenGL ES extensions added in iOS 6 now point to thefinal versions posted on the Khronos website.

Updated to include features introduced in iOS 6.Removed older articles containing changes in iOS 3.x.

Updated to include features introduced in iOS 5.1.Updated to include features introduced in iOS 5.0.Added features introduced in iOS 4.3.
Added features introduced in iOS 4.2.

Added features introduced in iOS 4.1.

Changed the title from "What's New in iPhone OS."

Added information about new features in iOS 4.0.

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

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.84

Document Revision History

Date

Notes

2009-08-27

2009-06-16

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

Added new features related to the introduction of new iPhone hardware.

2013-10-22 | Copyright © 2013 Apple Inc. All Rights Reserved.85

Apple Inc.
Copyright © 2013 Apple Inc.All rights reserved.

No part of this publication may be reproduced,stored in a retrieval system, or transmitted, in anyform or by any means, mechanical, electronic,photocopying, recording, or otherwise, withoutprior written permission of Apple Inc., with thefollowing exceptions: Any person is herebyauthorized to store documentation on a singlecomputer for personal use only and to printcopies of documentation for personal useprovided that the documentation containsApple’s copyright notice.

No licenses, express or implied, are granted withrespect to any of the technology described in thisdocument. Apple retains all intellectual propertyrights associated with the technology describedin this document. This document is intended toassist application developers to developapplications only for Apple-labeled computers.

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

Apple, the Apple logo, AirPlay, Apple TV, Cocoa,Cocoa Touch, iCal, Instruments, iPad, iPhone, iPod,iPod touch, iTunes, Keychain, Mac, Mac OS,Objective-C, OS X, Passbook, QuickTime, Safari,and Xcode are trademarks of Apple Inc.,registered in the U.S. and other countries.

AirDrop is a trademark of Apple Inc.

iAd and iCloud are service marks of Apple Inc.,registered in the U.S. and other countries.

App Store is a service mark of Apple Inc.

Java is a registered trademark of Oracle and/orits affiliates.

OpenGL is a registered trademark of SiliconGraphics, Inc.

UNIX is a registered trademark of The OpenGroup.

iOS is a trademark or registered trademark ofCisco in the U.S. and other countries and is usedunder license.

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

IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT,INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIALDAMAGES RESULTING FROM ANY DEFECT ORINACCURACY IN THIS DOCUMENT, even if advised ofthe possibility of such damages.

THE WARRANTY AND REMEDIES SET FORTH ABOVEARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORALOR WRITTEN, EXPRESS OR IMPLIED. No Apple dealer,agent, or employee is authorized to make anymodification, extension, or addition to this warranty.

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 have otherrights which vary from state to state. 

你可能感兴趣的:(平台-iOS,<=即时总结=>)