IPhone OS (iOS) Architecture

Source: Internet
Author: User
Tags openssl library
IPhone OS (now called iOS) is the operating system of iPhone, iPod touch, and iPad devices.

1. Core OS:

It is a Darwin written by FreeBSD and Mach, and is a Unix core that is open source and complies with POSIX standards. This layer includes or provides some basic functions of the entire iPhone OS, such as hardware drivers, memory management, program management, thread management (POSIX), file system, network (BSD Socket), standard input and output, etc. All these functions are provided through the C language API. In addition, it is worth noting that this layer has the most UNIX color. If you need to port the programs developed on UNIX to the iPhone, most of them will use the Core OS API.
The driver at the core OS layer also provides interfaces between the hardware and the system framework. However, due to security concerns, only limited system framework classes can access the kernel and driver.
The iPhone OS provides many interface sets for accessing low-level features of the operating system. iPhone applications access these functions through the LibSystem library. These interface sets are as follows:
Threads (POSIX Threads );
Network (BSD sockets );
File System access;
Standard I/O;
Bonjour and DNS services;
Locale Information );
Memory allocation;
Mathematical computation.
The header files of many Core OS technologies are located in the directory <iPhoneSDK>/usr/include/. iPhoneSDK is the SDK installation directory.
2. Core Services:

Core Services provides richer functions based on Core OS, including Foundation. framework and Core Foundation. framework is called Foundation because it provides a series of basic functions to process strings, arrange, combine, calendar, and time. Foundation is an API of Objective-C, and Core Fundation is an API of C. In addition, Core servieces provides other functions, such:
Security, Core Location, SQLite, and Address Book. among them, Security is used to process authentication, password management, and Security management; Core Location is used to process GPS positioning; SQLLite is a lightweight database, while AddressBook is used to process phone thin data. The following is a detailed introduction:
(1) Phone Book
The Mobile Phone Book framework (AddressBook. framework) provides a programming interface for the phone book stored on mobile devices. Developers can use this framework to access and modify records stored in the user contact database. For example, a chat program can use this framework to obtain a list of possible contacts, start the chat Process, and display the contact information in the view.
(2) core basic framework
CoreFoundation. framework is a C-language-based interface set that provides basic data management and service functions for iPhone applications. The Framework supports the following functions:
Collection data types (Arrays, Sets, etc );
Bundles;
String management;
Date and time management;
Raw data block management;
Preference management;
URL and Stream operations;
Run Loops );
Port and Socket communication.
The core and basic frameworks are closely related and provide Objective-C interfaces for the same basic functions. If developers use both the Foundation Objects and Core Foundation types, they can make full use of the "toll-free bridging" in the two frameworks ". Toll-free bridging means that developers can use any of the core and basic types of the two frameworks, such as Collection and string types. The description of classes and Data Types in each framework indicates whether the object supports toll-free bridged. If yes, the object it bridges with (toll-free bridged ).
(3) CFNetwork
CFNetwork framework is a set of high-performance C language interfaces that provide network protocol object-oriented abstraction. Developers can use the CFNetwork framework to operate protocol stacks and access low-layer structures such as BSD Sockets. At the same time, developers can also simplify communication with FTP and HTTP servers, or resolve DNS tasks. The tasks implemented using the CFNetwork framework are as follows:
BSD Sockets;
Use SSL or TLS to create an encrypted connection;
DNS Hosts resolution;
Parse the HTTP protocol to identify HTTP and HTTPS servers;
Working on the FTP server;
Publish, parse, and browse Bonjour services.
(4) Core Location Framework)
The core location. framework is used to obtain the current longitude and latitude of mobile devices. The core location framework uses nearby GPS, cellular base stations, or Wi-Fi signal information to measure the user's current location. The iPhone map app uses this function to display the current location of a user on a map. Developers can integrate this technology into their own applications to provide users with bit information services. For example, you can provide a service to find nearby restaurants, stores, or devices based on your current location.
(5) Security Framework)
In addition to the built-in Security features, the iPhone OS also provides an external Security framework to ensure the Security of application data. This framework provides interfaces for managing certificates, public/private key pairs, and trust policies. It supports generating encrypted and secure pseudo-random numbers, as well as certificates and keys stored in the key chain. It is a Secure knowledge base (Secure Repository) for sensitive user data ). The CommonCrypto interface also supports symmetric encryption, HMAC, and data summarization. There is no OpenSSL library in the iPhone OS, but the functions provided by the data digest are essentially the same as those provided by the OpenSSL library.
(6) SQLite
An iPhone application can embed a small SQL database SQLite without running another database server remotely. Developers can create local database files and manage tables and records in these files. Database SQLite is designed for general purposes, but can still be optimized to quickly access database records. The header file for accessing the database SQLite is in <iPhoneSDK>/usr/include/sqlite3.h, where <iPhoneSDK> is the target path for SDK installation.
(7) Support for XML
The basic framework provides the NSXMLParser class to parse XML document elements. The libXML2 library provides the ability to operate XML content. This open source library can quickly parse and edit XML data and convert XML content to HTML. The header file used to access the libXML2 library is located in the directory <iPhoneSDK>/usr/include/libxml2/, where <iPhoneSDK> is the target directory for SDK installation.
3, Media

Like its name, the Media layer provides multimedia functions such as images, music, and videos. Images are divided into 2D images and 3D images. The former is supported by Quartz2D, while the latter uses OpenglES. the modules corresponding to music are Core Audio and OpenAL. Media Player enables video playback and finally provides Core Animation for powerful Animation support. The details are as follows:
(1) Image Technology (Graphics Technologies)
High-quality images are an important part of all iPhone applications. At any time, developers can develop iPhone applications using existing views, functions, and predefined images in the UIKit framework. However, when the views and functions in the UIKit framework cannot meet the requirements, developers can apply the technologies and methods described below to create views.
① Quartz. The core image framework (CoreGraphics. framework) contains the Quartz 2D drawing API. Quartz is as advanced as the vector graphics engine used in Mac OS. Quartz supports Path-based plotting, Anti-obfuscation (Anti-aliased) overloading, Gradients, Images, and Colors), Coordinate-space Transformations, pdf document creation, display, and resolution. Although the API is based on the C language, it uses Object-based abstract representation of Basic drawing objects, making the image content easy to save and reuse.
② Core Animation ). Quartz core framework (QuartzCore. framework) includes the CoreAnimation interface, which is an advanced Animation and synthesis technology. It uses an optimized Rendering Path to implement complex animations and virtual effects. It uses a high-level Objective-C interface to configure the animation and effect, and then reload it to obtain better performance on the hardware. Core Animation is integrated into many parts of the iPhone OS, including the UIKit class such as UIView, which provides animations of many standard system behaviors. Developers can also use the Objective-C interface in this framework to create custom animations.
③ OpenGL ES. The OpenGL ES framework (OpenGLES. framework) complies with OpenGL ES v1.1 specifications and provides a tool for painting 2D and 3D content. The OpenGL ES framework is based on the C language and closely related to hardware devices. It provides high frame rates for full-screen game applications ). Developers always need to use the EAGL interface of the OpenGL framework. The EAGL interface is part of the OpenGL ES framework. It provides the OpenGL ES drawing code of the application and the interface of the local window object.
(2) Audio Technologies)
The audio technology of iPhone OS provides users with a rich audio experience. It includes audio playback, high-quality recording, and vibration triggering functions.
IPhone OS Audio technology supports the following Audio formats: AAC, Apple Lossless (ALAC), A-law, IMA/ADPCM (IMA4), Linear PCM, μ-law, and Core Audio.
① Core Audio Family ). The Core Audio family of frameworks provides local Audio support, as shown in table 16-1. Core Audio is a C-language-based interface that supports Stereo ). Develop a Core Audio framework that can use the iPhone OS to generate, record, mix, and play Audio in iPhone applications. Developers can also access the vibration function of mobile devices through core audio.
Core audio framework:
Framework)
Service)
CoreAudio. framework
Define the audio data type of the core audio
AudioUnit. framework
Provides audio and streaming media files
Play back and record, and manage audio
Audio files and playback prompts
AudioToolbox. framework
Provides built-in audio Unit services,
Audio Processing Module

② OpenAL. The iPhone OS also supports Open Audio Library (OpenAL ). OpenAL is a cross-platform standard that can transmit Positional Audio ). Developers can use OpenAL to achieve high-performance and high-quality audio in games or other applications that require location audio output.
Because OpenAL is a cross-platform standard, OpenAL code modules can be smoothly transplanted to other platforms.
(3) Video Technologies)
The iPhone OS supports full-screen video playback through the MediaPlayer. framework. The media playback framework supports the following video file formats:. mov,. mp4,. m4v, And. 3gp. The following compression standards are applied:
① H.264 Baseline Profile Level 264 video, with a resolution of 3.0x640 pixels at 30 f/s. Note: B frames is not supported;
② MPEG4 standard Video Section;
③ A large number of audio formats are included in the audio technology list, such as AAC, Apple Lossless (ALAC), A-law, IMA/ADPCM (IMA4) linear PCM, μ-law, and Core Audio.
4. Cocoa Touch

The top layer is Cocoa Touch, which is the Objective-c api, and the core part is UIKit. framework, a variety of components on the application interface, all provided by it, in addition to it is responsible for processing the screen multi-point touch events, text output, pictures, webpage display, access to cameras or files, and accelerated sensing. The details are as follows:
(1) UIKit framework
The UIKit framework contains the Objective-C program interface, which provides a key architecture for graphics and event-driven iPhone applications. Every application in the iPhone OS uses this framework to implement the following core functions:
Application Management;
Supports graphics and windows;
Supports touch event processing;
User Interface Management;
Provides objects used to characterize standard system views and controls;
Supports text and Web content;
Integrate with other applications through URL scheme.
To provide basic code for application creation, UIKit also supports some special features related to devices, as shown below:
Accelerate counting data;
Built-in Camera;
User Image Library;
Device Name and mode information.
(2) Basic Framework)
The basic framework supports the following features:
Collection data types (including Arrays and Sets );
Bundles;
String management;
Date and time management;
Raw data block management;
Preference management;
Threads and loops;
URL and Stream processing;
Bonjour;
Communication Port Management;
Internationalization.
(3) Address Book UI Framework)
The phone book UI framework (AddressBookUI. framework) is an Objective-C standard program interface. It is mainly used to create new contacts, edit and select existing contacts in the phone book. It simplifies the display of contact information in iPhone applications and ensures that all applications use the same program interface to ensure the consistency of applications on different platforms.

Summary:

When developing the iPhone program, we should first start from the upper layer and use the Objective-C encapsulated library, that is, through UIKit. framework and Foundation. framework for Development, and when faced with some complex functions, such as multimedia processing or drawing, and then find the relevant framwork on the lower layer.

From: http://blog.sina.com.cn/s/blog_62ba0fdd0100jupb.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.