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, see iOS 7 Release Notes . For the complete list ofnew APIs added in iOS 7, see iOS 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, see iOS 7 Design Re-sources . Dynamic Behaviors for Views Apps can now specify dynamic behaviors for UIView objects and for other objects that conform to the UIDynamicItem protocol. (Objects that conform to this protocol are called dynamic 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 UIAttachmentBehavior object 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 UICollisionBehavior object 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 UIGravityBehavior object 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 UIPushBehavior object specifies a continuous or instantaneous force vector for its dynamic items.A UISnapBehavior object 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 the UIDynamicAnimator class. 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, see UIKit 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 NSAttributedString class has been extended to support new attributes.The NSLayoutManager class generates glyphs and lays out text.The NSTextContainer class defines a region where text is laid out.The NSTextStorage class defines the fundamental interface for managing text-based content. For more information about Text Kit, see Text 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, see 64-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 the UIBackgroundModes key with the fetch value in your app’s Info.plist file. Then, when your app islaunched, call the setMinimumBackgroundFetchInterval: method to determine how often it receivesupdate messages. Finally, you must also implement the application: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 the UIBackgroundModes key with the remote-notification value in your app’s Info.plist file. You must also implement the application:didReceiveRemoteNotification:fetchCompletionHandler: method in your appdelegate. Apps supporting either the fetch or remote-notification background modes may be launched or movedfrom the suspended to background state at appropriate times. In the case of the fetch background 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 the NSURLRequest class. To upload or download larger pieces of content inthe background, use the new NSURLSession class. This class improves on the existing NSURLConnection class by providing a simple, task-based interface for initiating and processing NSURLRequest objects. A single NSURLSession object 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” in iOS 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, see Sprite Kit Programming Guide . To see an example ofhow to use Sprite Kit to build a working app, see code: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, see Game Controller Programming Guide . Game Center Improvements Game Center includes the following improvements: Turn-based matches now support a new feature known as exchanges . 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 a GKLeaderboardSet object, 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, see Game Center Programming Guide . For information about the classes of the Game Kit framework, see Game 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 MKMapCamera object 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 MKDirections class 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 MKGeodesicPolyline class lets you create a line-based overlay that follows the curvature of theearth. Apps can use the MKMapSnapshotter class to capture map-based images.The visual representation of overlays is now based on the MKOverlayRenderer class, which replaces overlay views and offers a simpler rendering approach. Apps can now supplement or replace a map’s existing tiles using the MKTileOverlay and MKTileOverlayRenderer classes. For more information about the classes of the Map Kit framework, see Map 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 existing UIActivityViewController class. 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’s Info.plist file.) 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 the Documents/Inbox directory 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, see UIActivityViewController 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, see Audio 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 the MCBrowserViewController class into their user interface to display a list of peerdevices for the user to choose from. Alternatively, you can use the MCNearbyServiceBrowser class to lookfor and manage peer devices programmatically. For more information about the interfaces of this framework, see Multipeer 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, see iOS 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 UIView class defines the following additions: The tintColor property applies a tint color to both the view and its subviews. For information on howto apply tint colors, see iOS 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 UIViewController class 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 UIViewControllerBasedStatusBarAppearance key in your app’s Info.plist file. The UIMotionEffect class 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 of UIImage supports 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 UIView and UIScreen for 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 UIKeyCommand class wraps keyboard events received from an external hardware keyboard. Theseevents are delivered to the app’s responder chain for processing. A UIFontDescriptor object describes a font using a dictionary of attributes. Use font descriptors tointeroperate with other platforms. The UIFont and UIFontDescriptor classes 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 UIActivity class 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 UIApplicationDelegate protocol adds methods for handling background fetch behaviors.The UIScreenEdgePanGestureRecognizer class 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 the UIStateRestoring protocol 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 a UISearchDisplayController object to work with a UINavigationBar object. For information about the classes of this framework, see UIKit 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, see Receipt 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, see Passbook 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 the kEAGLRenderingAPIOpenGLES3 constant to the initWithAPI: method. OpenGL ES 2 adds the following new extensions:The EXT_sRGB extension adds support for sRGB framebuffer operations. The GL_EXT_pvrtc_sRGB extension 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_instanced and GL_EXT_instanced_arrays extensions 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 the MAX_VERTEX_TEXTURE_IMAGE_UNITS attribute to determine the exact number of textures you canaccess. In earlier versions of iOS, this attribute always had a value of 0 . For more information, see OpenGL ES Programming Guide for iOS and iOS Device Compatibility Reference . Message UI Framework In the Message UI framework, the MFMessageComposeViewController class adds support for attachingfiles to messages. For information about the new interfaces, see the framework header files. For information about the classesof this framework, see Message UI Framework Reference . Media Player Framework In the Media Player framework, the MPVolumeView class 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, see Media 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, see Map 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 the MPMoviePlayerController class that let you run adsbefore a movie. The framework extends the UIViewController class 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, see Ad 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, see Game Kit Framework Reference . Foundation Framework The Foundation framework ( Foundation.framework ) includes the following enhancements: The NSData class adds support for Base64 encoding. The NSURLSession class 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 the NSURLConnection class and its delegate; it also replaces the NSURLDownload classand its delegate. The NSURLComponents class is a new class for parsing the components of a URL. This class supports theURI standard (rfc3986/STD66) for parsing URLs. The NSNetService and NSNetServiceBrowser classes support peer-to-peer discovery over Bluetoothand Wi-Fi. The NSURLCredential and NSURLCredentialStorage classes let you create credentials with asynchronizable policy, and they provide the option of removing credentials with a synchronizable policyfrom iCloud. The NSURLCache , NSURLCredentialStorage , and NSHTTPCookieStorage classes now support theasynchronous processing of storage requests. The NSCalendar class supports new calendar types.The NSProgress class 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, see Foundation 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, see Core 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, see Core 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, see Core 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, see Core 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 an NSUUID object to store unique identifiers.You can now retrieve peripheral objects from a central manager synchronously. For information about the classes of this framework, see Core Bluetooth Framework Reference and Core BluetoothProgramming Guide . AV Foundation Framework The AV Foundation framework ( AVFoundation.framework ) includes the following enhancements: The AVAudioSession class supports the following new behaviors:Selecting the preferred audio input, including audio from built-in microphones Multichannel input and output The AVVideoCompositing protocol and related classes let you support custom video compositors. The AVSpeechSynthesizer class 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 ratesHigh fps recordingStill image stabilizationVideo zoom (true and digital) in recordings and video preview, including custom rampingReal-time discovery of machine-readable metadata (barcodes) Autofocus range restrictionSmooth autofocus for captureSharing 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 usingthe AVAssetExportSession class. The AVAssetWriter class provides assistance in formulating output settings, and there are new levelconstants for H.264 encoding. The AVPlayerLayer class adds the videoRect property, which you can use to get the size and positionof the video image. The AVPlayerItem class supports the following changes:Asset properties can be loaded automatically when AVPlayerItem objects are prepared for playback. When you link your app against iOS 7 SDK, the behavior when getting the values of player itemproperties—such as the duration , tracks , or presentationSize properties—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 the AVPlayerItem object is not yet ready to play. As soon as the playeritem’s status changes to AVPlayerItemStatusReadyToPlay , 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 AVPlayerItemLegibleOutput class can process timed text from media files.The AVAssetResourceLoaderDelegate protocol 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, see AV Foundation Framework Reference . Accelerate Framework The Accelerate framework ( Accelerate.framework ) includes the following enhancements: Improved support for manipulating Core Graphics data typesSupport for working with grayscale images of 1, 2, or 4 bits per pixelNew 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, see Accelerate 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 the MKOverlayView class and its various subclasses.The existing overlay views have been replaced with an updated set of overlay renderer objects that descendfrom the MKOverlayRenderer class. For more information about the classes of this framework, see MapKit Framework Reference . The Audio Session API in the Audio Toolbox framework is deprecated. Apps should use the AVAudioSession class in the AV Foundation framework instead. The CLRegion class in the Core Location framework is replaced by the CLCircularRegion class. The CLRegion class continues to exist as an abstract base class that supports both geographic and beaconregions. The UUID property of the CBCentral class is deprecated. To specify the unique ID of your central objects,use the identifier property 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 wantsFullScreenLayout property of UIViewController is deprecated. In iOS 7 and later,view controllers always support full screen layout. UIColor objects that provided background textures for earlier versions of iOS are gone. Many drawing additions to the NSString class are deprecated in favor of newer variants.The gethostuuid function in the libsyscall library is deprecated. In iOS 7 and later, if you ask for the MAC address of an iOS device, the system returns the value 02:00:00:00:00:00 . If you need to identify the device, use the identifierForVendor property of UIDevice instead. (Apps that need an identifier for their own advertising purposes should consider usingthe advertisingIdentifier property of ASIdentifierManager instead.) For a complete list of specific API deprecations, see iOS 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, see iOS 6.1 Release Notes . For the complete listof new APIs added in iOS 6.1, see iOS 6.1 API Diffs . Map Kit Searches The Map Kit framework now lets you programmatically search for map-based addresses and points of interest.The MKLocalSearch class 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,see Map 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, see iOS 6.0 Release Notes . For the complete listof new APIs added in iOS 6, see iOS 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,see Location 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 new UIActivityViewController class 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, see Social Framework Reference . For information about the UIActivityViewController class, see UIKit 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, see PassbookProgramming 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 the GKChallenge class to issue challenges from within yourgame. The GKGameCenterViewController class 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 the authenticateHandler property 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 GKMatchmaker class 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 GKPlayer class now supports display names for players. The GKMatch class 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 the GKMatch infrastructure. The GKAchievement class now allows multiple achievements to be submitted at the same time.For more information about how to use Game Center in your app, see Game 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, see Event 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 SKDownload class represents a downloadable piece of content. In addition, the SKPaymentTransaction class 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, see Store Kit Framework Reference . Collection Views The UICollectionView class 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 UICollectionViewController class for managing the presentation of collection views in your appSupport for animating content within the collection viewBatch support for inserting, moving, and deleting itemsA simplified model for creating and managing cells and other views For more information about using collection views to implement your user interface, see Collection 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, see iOS 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, see Auto 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 a NULL value 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 its Info.plist file. 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 your Info.plist file, 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, see iOS 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 UICollectionView class (and its supporting classes and protocols) support the presentation ofordered collections of items; see “Collection Views” (page 29). UITextView and UITextField now support styled text using attributed strings.UIKit now includes support for drawing NSAttributedString and NSMutableAttributedString 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 UIActivityViewController class adds support for sharing content via services like email, Twitter, and Facebook; see also, “Social Framework” (page 27). The UIDevice class adds a vendor-specific identifier. The UIImage class includes new initialization methods for specifying the scale factor of an image. Appearance customization support has been added to the UIBarButtonItem , UIPageControl , UIPageViewController , UISwitch , and UIStepper classes. The UITableView class includes the following changes:Support for a new UITableViewHeaderFooterView class implements the table’s headers and footers A simplified model for creating and managing cells and other views. The UITableViewController class 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 UIWebView class provides a way to disable the incremental rendering of web content. The UIViewController class 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 UINavigationBar and incorporate your custom navigation bar into your app’snavigation interfaces. For information about the classes of the UIKit framework, see UIKit Framework Reference . OpenGL ES OpenGL ES includes the following new extensions: The GL_EXT_texture_storage extension 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_levels extension builds on top of the functionality of the GL_EXT_texture_storage extension and allows a set of texture mipmaps to be copied from one textureto another. The GL_EXT_map_buffer_range extension improves performance when you only need to modify a subsetof a buffer object. The GL_APPLE_sync extension 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_fetch extension 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 MPVolumeView class 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, see Media 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 the CGImageSourceRef and CGImageDestinationRef opaque types. For information about the classes of the Image IO framework, see Image 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, see iAd Framework Reference . Foundation Framework The Foundation framework ( Foundation.framework ) includes the following enhancements: The NSFileManager class includes the ubiquityIdentityToken method for determining the availabilityof iCloud, and the NSUbiquityIdentityDidChangeNotification notification for responding to auser logging into or out of iCloud, or changing accounts. The NSUUID class helps you create objects that represent various types of UUIDs (Universally UniqueIdentifiers). For example, you can create an NSUUID object with RFC 4122 version 4 random bytes, or youcan base it on an existing UUID string. The NSURLRequest class lets you specify whether a request should be allowed to happen over a cellularnetwork. The NSString class has new methods for converting a string to uppercase, lowercase, or an initial capitalcase. For information about the classes of the Foundation framework, see Foundation 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, see External 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 the calendarItemExternalIdentifier property of EKCalendarItem . 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 an EKEventEditViewController object.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, see Core Video Framework Reference . Core Media Framework The Core Media framework ( CoreMedia.framework ) adds the CMClockRef and CMTimebaseRef types,which define fundamental media time service behaviors. For information about the functions of the Core Mediaframework, see Core Media Framework Reference . Core Location Framework The Core Location framework ( CoreLocation.framework ) includes the following changes. The CLLocationManager object 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 the pausesLocationUpdatesAutomatically property of the location manager object. You can refine location accuracy based on usage by assigning an appropriate value to the activityType property of CLLocationManager . 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, see Core 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, see Multimedia Programming Guide . Forinformation about the new audio units, see Audio Unit Component Services Reference . AV Foundation Framework The AV Foundation framework ( AVFoundation.framework ) includes the following enhancements: The AVPlayer class 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 multiple AVPlayerLayer objects to display the visual outputof the same player object. The new AVPlayerItemOutput class works with an AVPlayerItem object to obtain decoded videoframes during playback so that your app can process them. The AVAssetResourceLoader class allows you to insert a delegate object into the asset loading processand handle custom resource requests. This class works with the AVURLAsset class. The AVAudioSession class now exposes information about the current audio route in use.The AVAudioMixInputParameters class provides access to an MTAudioProcessingTapRef data type, which can be used to access audio data before it is played, read, or exported. The AVAudioSession class 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 AVCaptureConnection class allows you to enable or disable support for video stabilization onincoming video. The AVCaptureMetadataOutput class is a new class for intercepting metadata emitted by a captureconnection object. The AVMetadataFaceObject is a new class that reports the face-detection data captured by an AVCaptureMetadataOutput object. The AVTextStyleRule class is a new class for specifying style options for subtitles, closed captions, andother text-related media assets. The AVAudioPlayer class can play audio items from the user’s iPod library using URLs obtained fromthe MPMediaLibrary class. You can also set channel assignments using the channelAssignments property. For information about the classes of the AV Foundation framework, see AV 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, see Ad 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, see Accelerate 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, see iOS 5.1 Release Notes . For the complete listof new APIs added in iOS 5.1, see iOS 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 new UIDictationPhrase class (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 the UITextInput protocol 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, see iOS 5.0 Release Notes . For the complete listof new APIs added in iOS 5.0, see iOS 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, see iCloud 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 Documents directory and most (but not all) of your app’s Library directory. To minimize the amountof data stored in the user’s iCloud account, developers are encouraged to put more files in the Library/Caches directory, 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, see iOS 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} Timeto produce Timeto 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 , or dealloc methods in your code. In addition, you cannot implement custom retain or release methods. Because you do not call the release method, there is often no need to implement a custom dealloc method—the compiler synthesizes all that is required to relinquish ownership of instance variables. Youcan provide a custom implementation of dealloc if 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 id and void* ). 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 NSAutoreleasePool objects.Instead, you must use a new @autoreleasepool keyword 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 to nil if the object to which itpoints is deallocated. There are qualifiers for variables, and new weak and strong declared 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, see What's New in Xcode . For more information about ARC itself, see Transitioningto 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: Configure your app’s Info.plist file to use storyboards: Add the UIMainStoryboardFile key and set its value to the name of your storyboard file. Remove the existing NSMainNibFile key. (Storyboards replace the main nib file.) Create and configure the storyboard file in Xcode; see “Creating Storyboard Files” (page 43). Update your view controllers to handle storyboard transitions; see “Preparing to Transition to a New ViewController” (page 44). 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’s Info.plist file. 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 the initial 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, a scene manages 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, see What'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 the prepareForSegue: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 the UIViewController class, 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 of UIViewController . 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 the instantiateViewControllerWithIdentifier: 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 in View 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: Newsstandappsmustincludethe UINewsstandApp keyintheir Info.plist filetoindicatethat 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 UIBackgroundModes key with the newsstand-content value in its Info.plist file, 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 the content-available property (with a value of 1 ) 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 CFBundleIcons key of your app’s Info.plist file. 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, see Newsstand Kit FrameworkReference . For information about how to use push notifications to notify your apps, see Local and PushNotification Programming Guide . For more information about setting up Newsstand subscriptions, see In-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 any UIScreen objects 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 the AVPlayer class to stream audio and video content overAirPlay; see AV 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; see MPNowPlayingInfoCenter Class Reference . The UIWebView class 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, see AirPlayOverview . 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 GLKView and GLKViewController classes 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 GLKTextureLoader class 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 , and GLKReflectionMapEffect classes provide configurablegraphics shaders that implement commonly used graphics operations. In particular, the GLKBaseEffect class 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, see GLKit 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 CIImage class 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 a CIFilter object for the appropriatefilter type. For information about the classes and filters of the Core Image framework, see Core 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 the TWTweetComposeViewController class, 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, see Twitter 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, see Accounts 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 IETF RFC 2743 and RFC 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 a UIDocument class 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, the UIDocument class 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 a UIManagedDocument subclass 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 UIDocument class, see UIDocument Class Reference . For information about the UIManagedDocument class, 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 NSFileProtectionCompleteUnlessOpen option, 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 NSFileProtectionCompleteUntilFirstUserAuthentication option, 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,see iOS 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 the UIAppearance protocol support the use of an appearance proxy.To modify the default appearance of such a class, retrieve its proxy object using the appearance classmethod 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 the UI_APPEARANCE_SELECTOR macro. For example, you can use a proxy object to change the default tint color (through the progressTintColor or trackTintColor properties) of the UIProgressView class. 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 the appearanceWhenContainedIn: 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 classin UIKit Framework Reference . Container View Controller Support The UIViewController class now allows you to define your own custom container view controllers andpresent content in new and interesting ways. Examples of existing container view controllers include UINavigationController , UITabBarController , and UISplitViewController . 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, see UIViewController 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”in iOS App Programming Guide . For information about the property-list keys you use to build your Settingsbundle, see Settings 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, see What'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 UIATarget object can now simulate rotate gestures and location changes. The UIAHost object supports executing a task from the Instruments app itself. The UIAElement object can now simulate a rotate gesture centered on the element. Several functions that were previously available only in UIAWindow and UIAPopover were moved to UIAElement because they are common to all element objects. The UIAKeyboard object now supports performing a sequence of keyboard taps to simulate the typingof a string. For information about the enhancements to the Automation instrument, see Instruments New Features UserGuide . For information about the JavaScript objects and commands that you use in your scripts, see UIAutomation 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, see Instruments 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, see iOS 5.0 API Diffs . UIKit The UIKit framework ( UIKit.framework ) includes the following enhancements: The UIViewController class 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 UIPageViewController class is a new container view controller for creating page-turn transitions between view controllers. The UIReferenceLibraryViewController class adds support for presenting a custom dictionaryservice to the user. The UIImagePickerController class supports new options for specifying the quality of video recordings.The UIStepper class 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 UIApplication class now reports the language directionality of the running app. The UITableView class adds support for automatic row animations, moving rows and sections,multiselection, and copy and paste behaviors for cells. The UIScreen class 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 UIScrollView class now exposes its gesture recognizers so that you can configure them moreprecisely for your app. The UISegmentedControl class now supports proportional segment widths.The UIAlertView class now supports password-style text entry and special configurations for entering text securely.The UIColor class includes support for Core Image and new methods to retrieve individual color values. The UIImage class 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 UITextInputTraits protocol adds support for a Twitter-specific keyboard and separate spell-checkingbehavior. The UIAccessibility protocol 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 UIAccessibilityReadingContent protocol allows you to provide a continuous, page-turningreading experience to VoiceOver users. The UIAccessibilityIdentification protocol allows you to uniquely identify elements in your appso that you can refer to them in automation scripts. The UIWebView class automatically supports the presentation of multimedia content over AirPlay. Youcan opt out of this behavior by changing the value in the mediaPlaybackAllowsAirPlay property ofthe class. This class also exposes a scrollView property so that you can access the scrolling propertiesof your web interfaces. For information about the classes of the UIKit framework, see UIKit Framework Reference . OpenGL ES OpenGL ES ( OpenGLES.framework ) now includes the following new extensions: The EXT_debug_label and EXT_debug_marker extensions 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_float extension allows 16-bit floating point formats to be specified for a framebuffer's color renderbuffer. The EXT_occlusion_query_boolean extension allows your app to determine whether any pixels would bedrawn by a primitive or by a group of primitives. The EXT_separate_shader_objects extension allows your app to specify separate vertex and fragmentshader programs. The EXT_shadow_samplers extension provides support for shadow maps.The EXT_texture_rg extension 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, see Message 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 the airPlayVideoActive property of the MPMoviePlayerController class. 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, see Map 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. The bannerViewWillLoadAd: method (definedin the ADBannerViewDelegate protocol) is called when a banner has confirmed that an ad is available butbefore the ad is fully downloaded and ready to be presented. The interstitialAdWillLoad: method(defined in the ADInterstitialAdDelegate protocol) offers similar behavior for interstitial ads. For information about the classes of the iAd framework, see iAd Framework Reference . Game Kit The Game Kit framework ( GameKit.framework ) and Game Center now have the following features: The GKTurnBasedMatch class 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 the GKLeaderboard class) 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 GKNotificationBanner class 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 the GKAchievement class. A GKMatchmakerViewController object can now add players to an existing match in addition tocreating a new match. The GKMatchDelegate protocol now includes a method to reconnect devices when a two-player matchis disconnected. For information about the classes of the Game Kit framework, see Game 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 NSFileManager class includes new methods for moving a file to a user’s iCloud storage.The new NSFileCoordinator class and NSFilePresenter protocol implement now locking support and notifications when manipulating documents in iCloud.The new NSFileVersion class reports and manages conflicts between different versions of a file in iCloud.The NSURL class includes new methods and constants to support syncing items to a user’s iCloud storage. The new NSMetadataQuery class supports attributes for items synced to a user’s iCloud storage. Severalother metadata-related classes were also added, including NSMetadataItem , NSMetadataQueryResultGroup , and NSMetadataQueryAttributeValueTuple . The new NSJSONSerialization class is a new class that supports back-and-forth conversions between JSON data and Foundation types. The new NSLinguisticTagger class 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 the NSFileWrapper class for managing file packages—that is, filesimplemented as an opaque directory. The new NSOrderedSet collection 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 on NSObject .For information about the classes of the Foundation framework, see Foundation 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 the UIBackgroundModes key with the external-accessory value in your app’s Info.plist file 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 the UIBackgroundModes key, see Information Property List Key Reference . Forinformation about interacting with external accessories, see External 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 called EKObject and portionsof the EKEvent class have been moved into a new base class called EKCalendarItem . With the EKEventStore class, 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 EKSource class represents the source for creating new calendars and events.The EKCalendar class now provides access to a calendar’s UUID, source, and other attributes. The Event Kit UI framework ( EventKitUI.framework ) now includes the EKCalendarChooser class, whichprovides a standard way for selecting from the user’s iCal calendars. For information about the classes of the Event Kit framework, see Event Kit Framework Reference . For informationabout the classes of the Event Kit UI framework, see Event 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, see Core 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, see Core 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, see Core 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. The UIManagedDocument class is a concrete subclass of UIDocument that 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 the NSPersistentStoreFileProtectionKey key 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 the NSManagedObjectContext class 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. The NSConfinementConcurrencyType optionprovides 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 the performBlock: or performBlockAndWait: method if your code is not already executing on that queue (for the main queuetype) or within the scope of a performBlock... invocation (for the private queue type). Within theblocks passed to those methods, you can use the methods of NSManagedObjectContext freely. The performBlockAndWait: method supports API reentrancy. The performBlock: method includes anautorelease pool and calls the processPendingChanges method 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, NSIncrementalStore and NSIncrementalStoreNode , 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, see Core 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, see Multimedia Programming Guide . Forinformation about the new audio units, see Audio 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 the allowsAirPlayVideo property of the AVPlayer class. New properties on the AVPlayerItem class indicate whether the item supports fast-forwarding orrewinding of the content. For information about the classes of the AV Foundation framework, see AV 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 streamsSupport for creating new albums in the user’s photo librarySupport for adding assets to albumsThe 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, see Assets 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, see Address 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 the SecureTransport.h header 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 see iOS 4.3 Release Notes . For the complete list of newAPIs added in iOS 4.3, see iOS 4.3 API Diffs . AirPlay Video Support Support for playing video using AirPlay is included in the MPMoviePlayerController class. This supportallows you to play video-based content on AirPlay–enabled hardware such as Apple TV. When the allowsAirPlay property of an active MPMoviePlayerController object is set to YES and 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 to NO by default.) Supported formats include: H.264 video with AAC audioHTTP streaming, both live and on demandprogressive download contentlocal 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:
