到底什么是私有 API,如果使用了 iOS 应用,为什么 Apple 会拒绝它?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17580251/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What exactly is a Private API, and why will Apple reject an iOS App if one is used?
提问by giant91
I've read several articles about this, and I just want to see if I understand this correctly:
我已经阅读了几篇关于此的文章,我只是想看看我是否理解正确:
Apple will reject your app if you use a Private API...
如果您使用私有 API,Apple 将拒绝您的应用...
What is the main difference between a "Private API" and a "Non-private API?"
Are the "Non-private" APIs only the APIs provided and verified by Apple?
Isn't an API just a way of interacting with a Framework, and a Framework is just a set of encapsulated classes/headers that people can use for trivial purposes?
Wouldn't this mean that I cannot reuse anyone's code (other than Apple's) at all in my app?
If this is true, whenever a programmer makes his or her own custom classes and methods, isn't he technically designing a mini Framework just for his specific purpose? So wouldn't this mean that he is using his own private API?
What would even be the difference between using someone else's classes/methods alongside my classes/methods, how could they even tell the difference, and why would this be a problem?
“私有 API”和“非私有 API”之间的主要区别是什么?
“非私有”API 是否仅是 Apple 提供和验证的 API?
API 不只是一种与 Framework 交互的方式,而 Framework 只是一组封装的类/头,人们可以将其用于琐碎的目的?
这是否意味着我根本无法在我的应用程序中重用任何人的代码(Apple 的代码除外)?
如果这是真的,那么每当程序员制作他或她自己的自定义类和方法时,他在技术上不就是为了他的特定目的而设计一个迷你框架吗?那么这是否意味着他正在使用自己的私有 API?
使用别人的类/方法和我的类/方法有什么区别,他们怎么能分辨出区别,为什么会出现问题?
My understanding of this sounds absurd, and don't believe I am understanding what a "Private API" is correctly. I did read that it was to protect against any changes in the API that could render your App dysfunctional. Does this mean APIs are linked during run time (as opposed to compile time) and can be updated automatically without you knowing or something? (See, I was originally thinking of APIs/frameworks as being set in stone whenever you compile, maybe this is where I am wrong)
我对此的理解听起来很荒谬,并且不相信我正确理解“私有 API”是什么。我确实读到它是为了防止 API 中的任何更改可能导致您的应用程序功能障碍。这是否意味着 API 是在运行时(而不是编译时)链接的,并且可以在您不知情的情况下自动更新?(看,我最初认为 API/框架在你编译时都是一成不变的,也许这就是我错的地方)
Can someone please help me out? I'm really confused about this policy. Thank you!
有人可以帮我吗?我真的对这个政策感到困惑。谢谢!
采纳答案by Wain
Q. What is the main difference between a "Private API" and a "Non-private API?"
问:“私有 API”和“非私有 API”之间的主要区别是什么?
- Private is one that isn't publicly defined (there isn't much to it)
- 私人是一种没有公开定义的(没有多少)
Q. Are the "Non-private" APIs only the APIs provided and verified by Apple?
问:“非私有”API 是否仅是 Apple 提供和验证的 API?
- Private and Public APIs are both 'provided' by Apple but only public APIs are provided for you to use.
- The private APIs are for use by Apple only
- 私有 API 和公共 API 均由 Apple“提供”,但仅提供公共 API 供您使用。
- 私有 API 仅供 Apple 使用
Q. Isn't an API just a way of interacting with a Framework, and a Framework is just a set of encapsulated classes/headers that people can use for trivial purposes?
问:API 不只是与框架交互的一种方式,框架只是一组封装的类/头,人们可以将其用于琐碎的目的吗?
- Yes
- 是的
Q. Wouldn't this mean that I cannot reuse anyone's code (other than Apple's) at all in my app?
问:这是否意味着我无法在我的应用程序中重用任何人的代码(Apple 除外)?
- No
- 不
Q. If this is true, whenever a programmer makes his or her own custom classes and methods, isn't he technically designing a mini Framework just for his specific purpose? So wouldn't this mean that he is using his own private API?
问:如果这是真的,那么每当程序员制作他或她自己的自定义类和方法时,他在技术上不就是为了他的特定目的而设计一个迷你框架吗?那么这是否意味着他正在使用自己的私有 API?
- No (a framework is different to an app)
- 否(框架与应用程序不同)
Q. What would even be the difference between using someone else's classes/methods alongside my classes/methods, how could they even tell the difference, and why would this be a problem?
问:使用别人的类/方法和我的类/方法有什么区别,他们怎么能分辨出区别,为什么会出现问题?
- It usually wouldn't
- 通常不会
The point you need to get is that when referring to private APIs you should only be thinking about private Apple supplied APIs.
Other APIs from 3rd parties are different (and Apple doesn't care so long as that 3rd party code doesn't use Apple private APIs).
您需要了解的一点是,在提及私有 API 时,您应该只考虑 Apple 提供的私有 API。
来自 3rd 方的其他 API 是不同的(只要 3rd 方代码不使用 Apple 私有 API,Apple 就不在乎)。