iphone Private API

Source: Internet
Author: User

A Basic knowledge

In addition to exposing the Api:published API (or the Api:documented API documented in the document), the APIs in the iphone also have two types of APIs: the private Api:private API and the unlisted api:unpublished API ( Or the api:undocumented API that is not documented in the document). The private API refers to the API placed in the Privateframeworks framework, the unlisted API is that although placed in the frameworks framework, but there is no official document in Apple has the use of instructions, code and other records of the API. The latter two APIs are different, according to Apple, the unpublished API is not mature enough, may also change the API, and so on fully formed will become a public API, but the current no commitment to it is that the system version upgrade may be invalidated. The private API is an API that Apple explicitly cannot use. Although there is a difference between the two, it is similar to the specific use method.

Two Specific introduction

1. Export the header file declaration that generated the private API

Using private or non-exposed APIs, you first need to export their corresponding header files, which have declarations of related functions in the header file.

Tools:

Class-dump

Class-dump can extract the corresponding data structure and function declaration from the compiled objective-c binary file.

How to use:

In order to use the Class-dump command in any directory, it is recommended that you copy the Class-dump file to the/user/local/bin/directory, and then execute the following command in any directory:

class-dump/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator3.0.sdk/system/library/ frameworks/uikit.framework/>uikit.h

The above command can be used to IPHONESIMULATOR3.0.SDK in the frameworks frame The data structure and function declaration of the Uikit.framework framework are extracted and placed in the UIKit.h file, after which you can find the declaration of the API and how to use it in this header file. In the same way, you can export the API declarations that you need in that framework.

You can also write the dumpframeworks.pl in Ericasadun (some comments in the file) this file extracts the API header files from the private framework. The use of the method is to first copy the Class-dump file to the/user/local/bin/directory, and then execute it in any directory. /dumpframeworks.pl will then generate a headers folder in your home directory, which lists the API header files under the private framework.

2. Using the Private API

After exporting the header file declaration of the private API, it is easier to use the method, first include the header file in your project, then import the corresponding framework, and then you can use these private API functions in our code in a way that provides a static library.

Three Important in the back

Some of the most sophisticated and playful APIs in iphone programming are included in the private API or the unlisted API, although we can use these very good APIs in this way, but there is a risk that there will be a change in the APIs that are not exposed first, so that in each firmware version, Your code is likely to be interrupted. At the same time, the biggest problem is that programs that use private APIs can't be sold on the App Store. So if we just experience these wonderful APIs in the iphone for fun, that's okay. If you're selling on the App Store for a program, don't move the idea of a private API.

iphone Private API

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.