IOS framework (5)-Core Services Layer

Source: Internet
Author: User

From http://blog.csdn.net/iukey/article/details/7666460

The core services layer is for all applications.ProgramProvides basic system services. 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 objectIs a C-level structure, you canCodeUse Quick object in. In essence, a block object is essentially an anonymous function plus the accompanying data of the function. Sometimes, other languages are also called block objects.ClosureOrLambda. 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, seeShort practices for block objects. For more information about block objects, seeBlock 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, seeConcurrent Programming Guide. For more information about specific GCD functions, seeGrand 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, seeProgramming Guide for In-APP purchase. 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, please readOrientation awareness programming guide. For more information about the core locatio framework, see "core location framework ".

SQLite

SQLite LibraryAllows developers to embed a lightweight SQL database into applications, 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<Ios_sdk>/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

Supported by the foundation frameworkNsxmlparserClass parses elements from XML documents, whileLibxml2The Library provides support for operating XML content.Libxml2The library is open-source, which allows you to quickly parse or write arbitrary XML data, or convert XML content into HTML files.

For accessLibxml2The header file of the 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. If you want moreLibxml2For more information, seeHttp://xmlsoft.org/index.htmWebsite.

Core Services Framework

The following sections describe the core services layer framework and the services provided by these frameworks.

Address book framework

Address book framework(Addressbook. FrameworkSupports 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, visitAddress book framework reference.

Cfnetwork framework

Cfnetwork framework(Cfnetwork. FrameworkProvides 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, visitCfnetwork programming guideAndCfnetwork framework reference.

Core data framework

IOS 3.0 IntroductionCore data framework (Coredata. Framework). Core data frameworkIt is a technology used to manage the data model of a Model-View-controller application. It is applicable to 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.

    • ProvideNsfetchedresultscontrollerClass is used to manage table View data.

    • 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, seeIOS core data tutorial. For more information about the classes in the core data framework, seeCore data framework reference.

Core foundation framework

Core foundation framework(Corefoundation. FrameworkIs 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-calledToll-free bridgingIt means that you can use some types in the core foundatio and foundation frameworks at the same time in the 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, seeCore foundation framework reference.

Core location framework

Core location framework(Corelocation. FrameworkCan 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 the Direction information of iOS devices (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, seeCore 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.

To learn more about the functions and data types of this framework, readCore 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.

To learn more about the classes and methods for using the framework, readCore 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.

To learn more about the classes and methods for using the framework, readEvent KIT framework referenceYou can also refer to the event kit UI framework.

Foundation framework

Foundation framework(Foundation. FrameworkProvides 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, readFoundation framework reference.

Mobile core services framework

IOS 3.0 introducedMobile core services framework(Mobilecoreservices. Framework). This framework defines the underlying types used by UTIs.

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

Quick look framework

IOS 4.0 introduces the quick look framework (Quicklook. Framework), The application can use this framework to preview the file content that cannot be directly viewed. 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, seeQuick look framework reference.

Store KIT framework

IOS 3.0 IntroductionStore KitFramework (Storekit. Framework). This framework supports content or services purchased in IOS apps. 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 the appropriate content to download (or unlock. 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, seeProgramming Guide for In-APP purchaseAndStore 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, seeSystem Configuration framework reference. If you want to use this framework to obtain network information, visitReachabilitySample project.

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.