Parse Core Services Layer

Source: Internet
Author: User

AnalysisCore ServicesLayer is the content to be introduced in this article. We will introduce the content of this article from multiple aspects.Core ServicesLayer provides basic system services for all applications. Maybe applications do not directly use these services, but they are the foundation of many parts of the system.

Advanced features

The following sections describe some of the more common features that may be intended for your application to support.

Block object

The block object is introduced in iOS 4.0. Block objects are constructed at the C level. You can use Quick objects in C or Objective-C code. In essence, a block object is essentially an anonymous function plus the accompanying data of the function. Sometimes, other languages also call block objects closure or lambda. Block objects are very suitable for callback functions. If you need a convenient way to combine the Execution Code and related data, block objects are also a good choice.

In iOS systems, block objects are usually used in the following scenarios:

As a substitute for delegate or delegate methods.

As a substitute for callback functions.

The processor used to perform one-time operations.

It simplifies the iteration of a task on all sub-items of a group.

Works with the distribution queue. It can be used to execute asynchronous tasks.

For more information about block objects and how to use them, see the short Practice Guide for block objects. For more information about block objects, see block object programming.

Grand Central Dispatch

IOS 4.0 introduces the Grand Central Dispatch (GCD), a BSD-level technology that can be used to manage the execution of multiple tasks within an application. GCD technology combines asynchronous programming models with highly optimized kernels and can be used as a convenient and more efficient alternative to multithreading. It also provides an alternative solution for many underlying tasks, such as reading and writing file descriptors, implementing timers, monitoring signals, and processing events.

For more information about how to use GCD in an application, see the concurrent programming guide. For more information about specific GCD functions, see the Grand Central Dispatch (GCD) reference.

In App Purchase)

IOS 3.0 introduces the in-APP purchase function. This feature allows you to sell content or services in your application. This function is implemented using the Store Kit framework. It can provide basic support for the handling of financial transactions using iTunes accounts. applications only need to process user experience and display of content or services for sale.

For more information about how iOS supports in-APP purchase, see the in-APP purchase programming guide. For more information about the Store Kit framework, see "Store Kit framework ".

Positioning Service

Applications can use the interfaces provided by the Core Location framework to track user locations. This framework uses currently available hardware radio waves, including Wi-Fi, cellular wireless, or GPS, to locate the user's current location. The application can crop the information provided by the framework and then send it to the customer or implement certain functions. For example, a social application allows you to find other nearby application users and then communicate with them.

To learn more about how to use the positioning service, read the orientation awareness programming guide. For more information about the Core Locatio framework, see "Core Location framework ".

SQLite

SQLite database allows developers to embed a lightweight SQL database into an application, and developers do not need to run independent remote database server processes. After that, developers can create local database files in the application to manage tables and records in files. Although the SQLite database is designed for general purposes, it is optimized for fast access to database records.

The header file used to access the SQLite library is located in

 
 
  1. <iOS_SDK> 
  2. /usr/include/sqlite3.h 

In this path, <iOS_SDK> is the path of the target sdk in the Xcode installation directory. If you need more information on how to use SQLite, visit the http://www.sqlite.org website.

XML support

The Foundation framework supports parsing elements from XML documents using the NSXMLParser class, while the libXML2 library provides support for operating XML content. The libXML2 library is open-source. It allows you to quickly parse or write arbitrary XML data, or convert XML content into HTML files.

The header file used to access the libXML2 library is located in <iOS_SDK>/usr/include/libxml2 /.

In this path, <iOS_SDK> is the path of the target sdk in the Xcode installation directory. For more information about how to use libXML2, visit the http://xmlsoft.org/index.htm website.

Core Services Framework

The following sections describe the Core Services layer framework and the Services provided by these frameworks.

Address Book framework

The Address Book framework (AddressBook. framework) supports programmatic access to the contact information stored on the user's device. If the application uses the contact information, you can use this framework to access and modify the records of the user contact database. For example, by using this framework, the chat program can obtain a list of contacts, use this list to initialize chat sessions, and display the list of contacts in the contact view.

To learn more about the functions of the Address Book framework, visit the Address Book framework reference.

CFNetwork framework

The CFNetwork framework provides a set of high-performance C-language-based interfaces that provide object-oriented abstraction for the use of network protocols. With these abstractions, you can more precisely control the protocol stack and use underlying structures such as BSD socket. You can also use this framework to simplify tasks such as communication with FTP or HTTP servers and DNS host resolution. The following lists some tasks that can be executed using the CFNetwork framework:

Use BSD sockets

Use SSL or TLS to create an encrypted connection

DNS host resolution

Use HTTP to verify HTTP and HTTPS servers.

Use an FTP server

Publish, parse, and browse Bonjour services.

CFNetwork theory and implementation are based on BSD socket. For more information about how to use the CFNetwork framework, see the CFNetwork programming guide and CFNetwork framework reference.

Core Data framework

IOS 3.0 introduces the Core Data framework (CoreData. framework ). The Core Data framework is a technology used to manage Model-View-controller application Data models. It is suitable for applications with highly structured Data models. With this framework, you no longer need to define the data structure through programming, but instead construct a chart representing the data model using the graphic tools provided by Xcode. When the program is running, the Core Data framework creates and manages Data model instances and provides external Data model access interfaces.

Using Core Data to manage the Data model of an application can greatly reduce the number of codes to be written. In addition, Core Data has the following features:

Store the object data in the SQLite database for performance optimization.

The NSFetchedResultsController class is provided to manage table views.

Manage undo/redo operations.

Attribute Value verification is supported.

Data changes can be propagated without changing the associations between objects.

Data can be classified and filtered, and memory data can be managed.

If you are developing a new application or are planning to significantly update an existing application, consider using Core Data. To learn how to use Core Data in iOS applications, refer to the iOS Core Data tutorial. For more information about the classes in the Core Data framework, see Core Data framework reference.

Core Foundation framework

The Core Foundation framework is a set of C language interfaces that provide basic data management and service functions for iOS applications. The following lists the data and services that the Framework supports for management:

Group data type (array, set, etc)

Package

String Management

Date and Time Management

Raw data block management

Preference Management

URL and data stream operations

Thread and RunLoop

Port and soket Communication

The Core Foundation framework is closely related to the Foundation framework. They provide interfaces for the same functions, but the Foundation framework provides Objective-C interfaces. If you mix the Foundation object with the Core Foundation type, you can use the "toll-free bridging" between the two frameworks ". The so-called Toll-free bridging means that you can use certain types of Core Foundatio and Foundation frameworks at the same time in methods or functions of a framework. Many data types support this feature, including group and string data types. The class and type descriptions of each framework describe whether an object is toll-free bridged and what object to bridge.

For more information, see the Core Foundation framework reference.

Core Location framework

The Core Location framework can be used to locate the current longitude and latitude of a device. It can use the hardware provided by the device to calculate the user's location through nearby GPS, cellular base stations, Wi-Fi signals, and other information. The Maps application uses this function to display the current user location on the map. You can integrate this technology into applications to provide orientation information to users. For example, an application can search for nearby hotels, shops, or other facilities based on the user's current location.

In iOS 3.0, the framework starts to support access to iOS devices with corresponding hardware.

In the iOS 4.0 system, the framework starts to support the location monitoring service with low energy consumption. This service uses the cellular base station to track the user's location.

For more information about the classes in the Core Location framework, see Core Location framework reference.

Core Media framework

IOS 4.0 introduces the Core Media framework (CoreMedia. framework ). This framework provides the underlying media types used by the AV Foundation framework. Only a few applications that require precise control over the creation and display of audio or video involve this framework. Most other applications should not be used.

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

Core Telephony framework

IOS 4.0 introduces the Core Telephony framework (CoreTelephony. framework ). This framework provides an interface for accessing telephone information on a device with cellular wireless. Applications can use it to obtain information about the provider of the user's cellular wireless service. If the application is interested in phone calls, you can also be notified when the corresponding event occurs.

For more information about how to use the framework classes and methods, see the Core Telephony framework reference.

Event Kit framework

IOS 4.0 introduces the Event Kit framework (EventKit. framework ). This framework provides interfaces for accessing calendar events of user devices. You can use this framework to access existing events in your calendar and add new events. Calendar events can contain alarms, and you can configure alarm activation rules.

For more information about how to use the framework classes and methods, see the Event Kit framework reference and the Event Kit UI framework reference.

Foundation framework

The Foundation. framework provides Objective-C encapsulation for many features of the Core Foundation framework. You can refer to the Core Foundation framework for a description of the previous Core Foundation framework. The Foundation framework supports the following features:

Group data type (array, set, etc)

Package

String Management

Date and Time Management

Raw data block management

Preference Management

URL and data stream operations

Thread and RunLoop

Bonjour

Communication Port Management

Internationalization

Regular Expression matching

Cache support

To learn more about the classes and methods for using the framework, read the Foundation framework reference.

Mobile Core Services framework

IOS 3.0 introduces the Mobile Core Services framework (MobileCoreServices. framework ). This framework defines the underlying types used by UTIs.

For more information about the types defined by this framework, see the uniform type identifier reference.

Quick Look framework

IOS 4.0 introduces the Quick Look framework (QuickLook. framework), which can be used by applications to preview files that cannot be viewed directly. This framework is ideal for applications that download files from the network or process files with unknown sources. As long as the application obtains the file, it can call the View Controller provided by the Framework to directly display the file content on the interface.

For more information about the classes and methods of the framework, see Quick Look framework reference.

Store Kit framework

IOS 3.0 introduces the Store Kit framework (StoreKit. framework), which supports content or services purchased in iOS applications. For example, developers can use this framework to allow users to unlock additional features of the application. Alternatively, if you are a game developer, you can use this feature to sell additional game levels to players. In the above two cases, the Store Kit framework will be in financial-related events during the transaction, this includes processing payment requests sent by users through the iTunes Store account and providing transaction-related information to applications.

The Store Kit framework focuses on financial-related transactions in the transaction process to ensure transaction security and accuracy. Other factors that the application needs to deal with, including the purchase interface and download or unlock, appropriate content. With this task division method, you have control over the purchased content and can decide the purchase interface you want to display to users and when to display them to users, you can also decide the delivery mechanism that best matches the application.

For more information about how to use the Store Kit framework, see the in-APP purchase programming guide and the Store Kit framework reference.

System Configuration framework

The System Configuration framework (SystemConfiguration. framework) can be used to determine the network Configuration of a device. You can use this framework to determine whether Wi-Fi or cellular connections are in use or whether a host service can be used.

For more information about the interfaces provided by this framework, see the System Configuration framework reference. If you want to use this framework to obtain network information, visit the Reachability sample project.

Summary: AnalysisCore ServicesI hope this article will help you.

From: http://www.cnblogs.com/qq78292959/archive/2011/05/25/2076920.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.