What are private APIs?

What does Apple mean when they refer to private APIs?

+13
objective-c ipad
Jun 08 '10 at 19:42
source share
4 answers

Undocumented APIs or APIs that they do not explicitly disclose to the developer.

As long as you can access them, there is no guarantee that these APIs will not change in future versions of iOS, as well as the correct payment method to reject your application.

+18
Jun 08 '10 at 19:44
source share

A private method is a method that is used as an implementation part, not a [public] part of an interface. In other languages, where public and private methods are more efficient, private methods usually cannot be called by anything other than the class in which they are contained. The purpose of this is to hide implementation details or prevent external dependency on implementation details. For example, NSArray probably has a number of private methods that deal with memory allocation and optimized storage for efficient access.

Objective-C has no truly private methods; You can send any message you want for free, and it can respond to it, or maybe not. At run time, you can also check exactly which messages the class (and its instances) will respond through a series of calls to the Objective-C Runtime API [which are publicly documented].

Some people try to use private methods to obtain program behavior, which is not possible with a publicly documented interface; perhaps as an optimization, perhaps to do something that the API was never going to do. This is easily possible due to the dynamic nature of Objective-C and the lack of true private methods.

As a side note; Apple typically uses leading underscores in method names to indicate that it is private. Apple also states that method names beginning with an underscore are reserved for Apple only.

+5
Jun 09 '10 at 13:16
source share

A private API is usually a method call that should not be called by third-party developers. These calls are usually reserved for the product / API provider (Apple) and usually β€œprivate” because their implementation may change in the future - and if they allow developers to use them and changes in the implementation, the application may break.

+1
Jun 08 '10 at 19:45
source share

They mean APIs that are only for Apple. Or rather, do NOT use the SDKs at all.

0
Jun 08 '10 at 19:44
source share



All Articles