macos 什么是 Private FrameWorks,我们将如何使用它们?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2678047/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:53:44  来源:igfitidea点击:

What are Private FrameWorks and how will we use them?

iphonemacosframeworks

提问by Shahrukh

My Question is about private framworks in IphoneOS3.1SDK dirctory

我的问题是关于 IphoneOS3.1SDK 目录中的私有框架

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/

What are they ? and when i added one of them to my project, they didn't have any headers? How can i use them in my project?

这些是什么 ?当我将其中一个添加到我的项目时,它们没有任何标题?我如何在我的项目中使用它们?

回答by kennytm

Private frameworks are frameworks which you are not allowed to use. They are not expected to be used outside of Apple, hence "Private". They are often lower-level libraries which may "break" the system if not used correctly. (But the frameworks have to exist because Apple's apps and public frameworks do use the private frameworks.)

私有框架是不允许您使用的框架。它们预计不会在 Apple 之外使用,因此是“私有的”。它们通常是较低级别的库,如果使用不当可能会“破坏”系统。(但框架必须存在,因为 Apple 的应用程序和公共框架确实使用私有框架。)

Since the private frameworks are not for public use, Apple doesn't need to give any headers or documentations away.

由于私有框架不供公共使用,Apple 不需要提供任何标题或文档。

If you're writing for AppStore, you should notuse private frameworks (unless you're from Apple). The system will immediately reject your app even before the review process begins.

如果您为 AppStore 编写代码,则不应使用私有框架(除非您来自 Apple)。即使在审核过程开始之前,系统也会立即拒绝您的应用。



(On the other hand, for jailbroken platforms you're free to use any frameworks. Even so, the APIs of private frameworks is unstable, that you should avoid them if possible.

(另一方面,对于越狱平台,您可以自由使用任何框架。即使如此,私有框架的API 是不稳定的,您应该尽可能避免使用它们。

There is an ongoing effort to document these private frameworks and API in http://iphonedevwiki.net/index.php/Main_Page.)

正在努力在http://iphonedevwiki.net/index.php/Main_Page 中记录这些私有框架和 API 。)

回答by jessecurry

Avoid using private frameworks if you would like to submit your App to Apple. Otherwise, you may call any of the available private methods with your own code. Erica Sadun has some info regarding private frameworks on her site.

如果您想将您的应用程序提交给 Apple,请避免使用私有框架。否则,您可以使用自己的代码调用任何可用的私有方法。Erica Sadun 在她的网站上有一些关于私有框架的信息。

回答by newenglander

While the other answers are generally true, there is one small exception that deserves to be mentioned.

虽然其他答案通常是正确的,但有一个小例外值得一提。

There are some cases where certain contentsof private frameworks (besides code libraries there are often databases and similar binary, non-executable files inside them) can be used (bundled) in App Store apps. One such example is the RMPhoneFormatclass from @rmaddy, which uses "a copy of an Apple provided private framework file named Default.phoneformat". The author (no doubt other developers as well) has used this binary file in App Store apps without problems.

在某些情况下,可以在 App Store 应用程序中使用(捆绑)私有框架的某些内容(除了代码库,其中通常还有数据库和类似的二进制不可执行文件)。一个这样的例子是来自@rmaddy的RMPhoneFormat类,它使用“Apple 提供的名为 Default.phoneformat 的私有框架文件的副本”。作者(毫无疑问其他开发人员也是如此)在 App Store 应用程序中使用这个二进制文件没有问题

(I don't know whether this is due to the fact that Apple tolerates this practice, or that they just don't check for this type of usage in their approval process.)

(我不知道这是因为 Apple 容忍这种做法,还是他们只是在审批过程中没有检查这种类型的使用。)