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. The block object is constructed at the C level. 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 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 <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 framework
Nsxmlparser
Class parses elements from XML documents, while
Libxml2
The Library provides support for operating XML content.
Libxml2
The library is open-source, which allows you to quickly parse or write arbitrary XML data, or convert XML content into HTML files.
For access
Libxml2
The 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 more
Libxml2
For usage information, 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
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
Cfnetwork framework (
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.
Provide
Nsfetchedresultscontroller
Class 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, 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
Core foundation framework (
Corefoundation. 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
Core location framework (
Corelocation. 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 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, 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
Foundation framework (
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
), 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, see quick look framework reference.
Store KIT framework
IOS 3.0 introduces the store KIT framework (
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, 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.