What does Apple mean when they refer to private APIs?
Undocumented API's, or API's they haven't explicitly exposed to the developer.
While you may access them, there is no guarentee that these API's will not change in future revisions to iOS, plus it's a sure fire way to get your app rejected.
A private method is one that is used as an implementation detail rather than a [public] interface detail. In other languages where public and private methods are more enforceable, private methods typically cannot be called from anything other than the class that they are contained within. The purpose of which is to hide implementation details, or to prevent external reliance on implementation details. For example, NSArray
probably has a number of private methods that deal with memory allocation and optimised storage for efficient access.
Objective-C does not have truly private methods; you are free to send whatever message you want to any object, and it may respond to it or it may not. At runtime, you are also able to inspect exactly which messages a class (and its instances) will respond to through a series of Objective-C Runtime API calls [that are publicly documented].
Some people attempt to use private methods to obtain program behaviour that is not possible with the publicly documented interface; perhaps as an optimisation, perhaps to do something that the API was never meant to do. It is easily possible because of Objective-C's dynamic nature and lack of true private methods.
As a side note; Apple typically use a leading underscore in method names to denote that it is private. Apple also state that method names beginning with an underscore are reserved for Apple only.
A private API is usually a method call which isn't supposed to be called by third party developers. These calls are usually reserved for the vendor of the product/API (Apple), and are usually "private" because the implementation of them could change in the future - and if they let developers use them and the implementation changes, the application could break.
They mean APIs that are for use by Apple only. Or to be more correct, generally NOT to be used by SDK developers.
© 2022 - 2024 — McMap. All rights reserved.