|
iPhone OS Technologies
The implementation of iPhone OS can be viewed as a set of layers, which are shown inFigure 2-1. At the lower layers of the system are the fundamental services on which all applications rely, while higher-level layers contain more sophisticated services and technologies.
Cocoa Touch
TheCocoa Touchlayer is one of the most important layers in iPhone OS. It comprises the UIKit and Foundation frameworks (UIKit.frameworkandFoundation.framework), which provide the basic tools and infrastructure you need to implement graphical, event-driven applications in iPhone OS. It also includes several other frameworks that provide key services for accessing device features, such as the user’s contacts.
TheUIKitframework (UIKit.framework) is an Objective-C framework that provides the key infrastructure for implementing graphical, event-driven applications in iPhone OS. Every application in iPhone OS uses this framework to implement this core set of features:
- Application management
- Graphics and windowing support
- Event-handling support
- User interface management
- Objects representing the standard system views and controls
- Support for text and web content
In addition to providing the fundamental code for building your application, UIKit also incorporates support for some device-specific features, such as the following:
- Accelerometer data
- The built-in camera (where present)
- The user’s photo library
- Device-specific information
For information about the classes of the Foundation and UIKit frameworks, seeFoundation Framework ReferenceandUIKit Framework Reference.
Media
The graphics and media technologies in iPhone OS are geared toward creating the best multimedia experience available on a mobile device. More importantly, these technologies were designed to make it easy for you to build good-looking and -sounding applications quickly. The high-level frameworks in iPhone OS make it easy to create advanced graphics and animations quickly, while the low-level frameworks provide you with access to the tools you need to do things exactly the way you want.
In this section:
Graphics Technologies
Core Audio
OpenAL
Video Technologies
Graphics Technologies
High-quality graphics are an important part of all iPhone applications, and iPhone OS provides several key technologies to do your 2D and 3D drawing.Table 2-1lists the technologies available for you to use in iPhone OS.
Table 2-12D and 3D graphics technologiesFramework
Services
OpenGLES.framework
TheOpenGL ESframework (OpenGLES.framework) is based on the OpenGL ES v1.1 specification and provides tools for drawing 2D and 3D content. It is a C-based framework that works closely with the device hardware to provide high frame rates for full screen game-style applications. You always use this framework in conjunction with the EAGL framework.
For details about the available OpenGL ES support, see“Drawing with OpenGL ES.”
EAGL.framework
TheEAGLframework provides the interface between your OpenGL ES drawing code and the native window objects of your application.
QuartzCore.framework
Core Animation(QuartzCore.framework) is an advanced animation and compositing technology that uses an optimized rendering path to implement complex animations and visual effects. It provides a high-level, Objective-C interface for configuring animations and effects that are then rendered in hardware for performance. Core Animation is integrated into many parts of iPhone OS, including UIKit classes such asUIView, providing animations for many standard system behaviors. You can also use the Objective-C interface in this framework to create custom animations.
CoreGraphics.framework
Quartz(CoreGraphics.framework) is the same advanced, vector-based drawing engine that is used in Mac OS X for drawing. It provides support for path-based drawing, anti-aliased rendering, gradients, images, colors, coordinate-space transformations, and PDF document creation, display, and parsing. Although the API is C-based, it uses object-based abstractions to represent fundamental drawing objects, making it easy to store and reuse your graphics content.
For more information about the available graphics technologies, including examples of how to use them, see“Graphics and Drawing.”
Core Audio
Native support for audio is provided by the Core Audio family of frameworks, listed inTable 2-2.Core Audiois a low-latency C-based interface that supports the manipulation of multichannel audio. You can use Core Audio in iPhone OS to generate, record, mix, and play audio in your applications. You can also use Core Audio to access the vibrate capability on devices that support it.
Table 2-2Core Audio frameworksFramework
Services
CoreAudio.framework
Provides audio type and file format information.
AudioToolbox.framework
Provides playback and recording services for audio files and streams. This framework also provides support for managing audio files and playing system alert sounds.
AudioUnit.framework
Provides services for using audio units, which are audio processing modules.
For information about using Core Audio to play and record audio, see“Using Sound in iPhone OS.”
OpenAL
In addition to Core Audio, iPhone OS includes support for theOpen Audio Library (OpenAL). The OpenAL interface is a cross-platform standard for delivering 3D audio in applications. You can use it to implement high-performance positional audio in games and other programs that require high-quality audio output. Because OpenAL is a cross-platform standard, the code modules you write using OpenAL in iPhone OS can be ported to run on many other platforms.
For information about OpenAL, including how to use it, seehttp://www.openal.org.
Video Technologies
iPhone OS provides support for full-screen video playback through theMedia Playerframework (MediaPlayer.framework). This framework supports the playback of movie files with the.mov,.mp4,.m4v, and.3gpfilename extensions and using the following compression standards:
- H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. Note that B frames are not supported in the Baseline profile.
- MPEG-4 Part 2 video (Simple Profile)
- Numerous audio formats, including:
- AAC
- Apple Lossless (ALAC)
- A-law
- IMA/ADPCM (IMA4)
- linear PCM
- µ-law
For information on how to use this framework, see“Playing Video Files.”
Core Services
TheCore Serviceslayer provides the fundamental system services that all applications use. Even if you do not use these technologies directly, every other technology in the system is built on top of them.
In this section:
Address Book
Core Foundation
Core Location
CFNetwork
Security
SQLite
XML Support
Address Book
The Address Book framework (AddressBook.framework) provides programmatic access to the contacts stored on a user’s device. Applications that need access to this information, such as email and chat programs, can use this framework to access the data stored in contact records directly. Those programs can use the information internally or provide a custom user interface for displaying that data. For information about the functions in this framework, seeAddress Book Framework Reference.
The Address Book UI framework (AddressBookUI.framework) complements the Address Book framework by providing a graphical interface for accessing the user’s contacts. You use the Objective-C classes in this framework to present the system standard interfaces for picking existing contacts and creating new contacts. For information about the classes in this framework, seeAddress Book UI Framework Reference.
Core Foundation
TheCore Foundationframework (CoreFoundation.framework) is a set of C-based interfaces that provide basic data management and service features for iPhone applications. This framework includes support for the following:
- Collection data types (arrays, sets, and so on)
- Bundle support
- String management
- Date and time management
- Raw data block management
- Preferences management
- URL and Stream manipulation
- Thread and run loop support
- Port and socket communication
The Core Foundation framework is closely related to the Foundation framework, which provides Objective-C interfaces for the same basic features. In situations where you need to mix Foundation objects and Core Foundation types, you can take advantage of the “toll-free bridging” that exists between the two frameworks.Toll-free bridgingmeans that you can use some Core Foundation and Foundation types interchangeably in the methods and functions of either framework. This support is available for many of the data types, including the collection and string data types. The class and type descriptions for each framework list whether an object is toll-free bridged and, if so, what object it is bridged with.
For more information about this framework, seeCore Foundation Framework Reference.
Core Location
The Core Location framework (CoreLocation.framework) lets you determine the current latitude and longitude of a device. The framework uses the available hardware to triangulate the user’s position based on nearby signal information. The Maps application uses this feature to show the user’s current position on a map, and you can incorporate this technology into your own applications to provide position-based information to the user. For example, a service that searched for nearby restaurants, shops, or facilities could base that search on the user’s current location. For information about how to use this framework to get the user’s location, see“Getting the User’s Current Location.”
CFNetwork
TheCFNetworkframework (CFNetwork.framework) is a high-performance, C-based framework that provides a set of object-oriented abstractions for working with network protocols. These abstractions give you detailed control over the protocol stack and make it easy to use lower-level constructs such as BSD sockets. You can use this framework to simplify tasks such as communicating with FTP and HTTP servers or resolving DNS hosts. Here are some of the tasks you can perform with the CFNetwork framework. You can:
- Use BSD sockets
- Create encrypted connections using SSL or TLS
- Resolve DNS hosts
- Work with HTTP, authenticating HTTP and HTTPS servers
- Work with FTP servers
- Publish, resolve, and browse Bonjour services
CFNetwork is based, both physically and theoretically, on BSD sockets. For information on how to use CFNetwork, seeCFNetwork Programming GuideandCFNetwork Framework Reference.
Security
In addition to its built-in security features, iPhone OS also provides an explicitSecurityframework (Security.framework) that you can use to guarantee the security of the data your application manages. This framework provides interfaces for managing certificates, public and private keys, and trust policies. It supports the generation of cryptographically secure, pseudo-random numbers. It also supports the storage of certificates and cryptographic keys in the keychain, which is a secure repository for sensitive user data.
For information about the functions and features associated with the Security framework, seeSecurity Framework Reference.
SQLite
TheSQLite librarylets you embed a lightweight SQL database into your application without running a separate remote database server process. From your application, you can create local database files and manage the tables and records in those files. The library is designed for general purpose use but is still optimized to provide fast access to database records.
The header file for accessing the SQLite library is located in<Xcode>/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include/sqlite3.h, where<Xcode>is the path to your Xcode installation directory. For more information about using SQLite, go tohttp://www.sqlite.org.
XML Support
Support for manipulating XML content is provided by thelibXML2andlibxsltlibraries. These are open source libraries that you can use to parse or write arbitrary XML data quickly and transform XML content to HTML.
The header files for accessing thelibXML2library are located in<Xcode>/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include/libxml2/, where<Xcode>is the path to your Xcode installation directory. The headers for thelibxsltlibrary are in<Xcode>/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include/libxslt/. For more information about usinglibXML2andlibxslt, go tohttp://xmlsoft.org/index.html.
Core OS
TheCore OSlayer encompasses the kernel environment, drivers, and basic interfaces of the operating system. The kernel itself is based on Mach and is responsible for every aspect of the operating system. It manages the virtual memory system, threads, file system, network, and inter-process communication. The drivers at this layer also provide the interface between the available hardware and the system frameworks that vend hardware features. Access to kernel and drivers is restricted to a limited set of system frameworks and applications.
iPhone OS provides a set of interfaces for accessing many low-level features of the operating system. Your application accesses these features through theLibSystemlibrary. The interfaces are C-based and provide support for the following:
- Threading (POSIX threads)
- Networking (BSD sockets)
- File-system access
- Standard I/O
- Bonjour and DNS services
- Locale information
- Memory allocation
- Math computations
For information about the functions available in the LibSystem library, seeiPhone OS Manual Pagesin the iPhone Reference Library.
|
|