Apple and private APIs

Now that he has publicly discovered that App Store applications are being tested for using private APIs, I need to ask a question ... what is a private API so that I can avoid them?

+6
ios iphone iphone-privateapi
Nov 20 '09 at 22:24
source share
7 answers

A private API is an API that is not documented in the SDK. For example, the framework class may declare a method that is not intended for use by third-party developers. Private API behavior is not guaranteed. You cannot even be sure that this method will be present in future platform updates. His ad is probably not available in the public SDK header files. If you stick with the public things in the SDK documentation, you'll be fine.

+14
Nov 20 '09 at 22:27
source share

It will be difficult for you to use a private API by accident. They are not documented in the SDK documents, and they do not appear in Xcode completion suggestions.

The reason that this has become news lately is that the creator of the framework used by several applications uses a private API, so when the developers who included his framework updated their applications, they were rejected (although the THOSE developers did not use the private API that they added to your application).

As for the only way to use the private API by accident.

+5
Nov 20 '09 at 22:34
source share

These are not just private APIs that can cause your application to reject. Using undocumented members of the public API may result in your application being rejected. For example, the tr20 library (as fixed) gained access to _phase and other UITouch members within the category.

They can also detect private member calls using the performSelector function, since the following is also marked as a reject:

UIWindow* window = [UIApplication sharedApplication].keyWindow] return !![window performSelector:@selector(firstResponder)]; 

More disturbing, if you create an application for 3.1 and 3.0, and at runtime in 3.0 you do not use any of 3.1, your application may still be rejected. An example would be cameraOverlayView of UIImagePickerController (see here ). This is a little puzzling.

+3
Dec 05 '09 at 15:54
source share

As a rule, their absence from the SDK headers. One of Apple's conventions is to list ObjC method names with underscores.

+1
Nov 20 '09 at 22:28
source share

A great tool to use before submitting the app is the App Scanner. It scans your .app file to use a private API and shows which method signatures match and which classes are in these methods.

link → http://www.chimpstudios.com/appscanner/

+1
Oct 10 2018-10-10
source share

My application was rejected by Apple due to the use of a private API. Here is the code

  Class UIKeyboardImpl = NSClassFromString(@"UIKeyboardImpl"); id activeInstance = [UIKeyboardImpl performSelector:@selector(activeInstance)]; [activeInstance performSelector:@selector(dismissKeyboard)]; 
+1
Jul 13 '12 at 3:17
source share

It is easy to get a deviation from the so-called "use of private API". Try using the following Core Data attribute and it will be rejected:

  • colorIndex
  • Introduction
  • ID

Shows how the robot scans the API.

0
Nov 21 '09 at 2:59
source share



All Articles