简体   繁体   English

什么是未公开的方法和私有API?

[英]What is an undocumented method and a private API?

Recently I have get a reject from Apple because a use of a private API. 最近,我因使用私有API而遭到苹果的拒绝。 I don't know exactly what is a private API nor an undocumented method. 我不确切知道什么是私有API或未记录的方法。 Could someone explain me what is an undocumented method and a private API? 有人可以向我解释什么是未公开的方法和私有API? I'm really confused with that... 我真的很困惑...

Follow up: 跟进:

  • What is exactly the "official documentation"? 什么是“官方文档”? Can I use some frameworks and classes made by thirds such as the Amazon one? 我可以使用三分之二的框架和类吗,例如亚马逊的框架和类?

A private API or undocumented method is any object or method that is not part of the official documentation. 私有API或未记录的方法是不属于正式文档的任何对象或方法。 In Objective C, and some other languages, it is relatively easy to find the list of methods (messages) that an object supports as well as the objects underlying the framework. 在Objective C和其他一些语言中,相对容易找到对象支持的方法(消息)列表以及框架下的对象。 (For example, just go into the debugger and look at the view hierarchy. You will likely see several view objects that don't exist in the documentation.) Sometimes you will even see instructions on how to use these methods and objects on the web. (例如,只需进入调试器并查看视图层次结构。您可能会看到文档中不存在的几个视图对象。)有时,您甚至会看到有关如何在Web上使用这些方法和对象的说明。 。

One example that leaps to mind is -UIWindow _autolayoutTrace , I use it all the time when debugging autolayout, but it isn't documented and the leading underscore is a hint that you shouldn't be using it. -UIWindow _autolayoutTrace一提的例子是-UIWindow _autolayoutTrace ,我在调试自动布局时一直使用它,但是没有记录在文档中,并且最主要的下划线表示您不应该使用它。 That's fine for debugging, but if I shipped code that used that method it would be certain to be rejected. 这对于调试很好,但是如果我提供了使用该方法的代码,那肯定会被拒绝。

But Apple specifically scans for these undocumented methods as part of the App Store review process and rejects apps that use them. 但是Apple在App Store审查过程中专门扫描了这些未记录的方法,并拒绝了使用它们的应用程序。 This is because Apple might change how these undocumented methods work at any time. 这是因为Apple可能随时更改这些未公开记录的方法的工作方式。 If your app was dependent on one of these hidden classes or methods your app might break when Apple released a new version of the SDK that changed this behavior. 如果您的应用程序依赖于这些隐藏的类或方法之一,则在Apple发布更改此行为的新版SDK时,您的应用程序可能会损坏。

There's a set of functionalities that Apple uses internally but are not publicly available for developers. Apple内部使用了一组功能,但开发人员无法公开使用这些功能。

Any usage of such APIs will result in a rejection of the application by Apple. 此类API的任何使用将导致Apple拒绝该应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM