Mac OS X中的框架到底是什么? (* .framework文件夹) [英] What exactly is a Framework in Mac OS X? ( *.framework folders )

查看:1164
本文介绍了Mac OS X中的框架到底是什么? (* .framework文件夹)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我基本上知道现实生活中的框架是什么.我看过一些框架,其中包含一些头文件和一个二进制文件.是吗除了作为带有链接到应用程序的标头和库的文件夹之外,OS X框架是否还具有特殊功能?

Ok, I know basically what a framework is in real life. I've seen some frameworks that hold some header files and a binary. Is that it? Does an OS X framework have special features other than just being a folder with headers and libraries you link to your application?

推荐答案

框架信息

来自 Apple开发者连接:框架定义:

框架是一个捆绑包(结构化目录),其中包含动态共享库以及相关资源,例如nib文件,图像文件和头文件.开发应用程序时,您的项目将链接到一个或多个框架.例如,iPhone应用程序项目默认情况下链接到Foundation,UIKit和Core Graphics框架.您的代码通过应用程序编程接口(API)访问框架的功能,该API由框架通过其头文件发布.因为该库是动态共享的,所以多个应用程序可以同时访问框架代码和资源.系统根据需要将框架的代码和资源加载到内存中,并在所有应用程序之间共享资源的一个副本.

A framework is a bundle (a structured directory) that contains a dynamic shared library along with associated resources, such as nib files, image files, and header files. When you develop an application, your project links to one or more frameworks. For example, iPhone application projects link by default to the Foundation, UIKit, and Core Graphics frameworks. Your code accesses the capabilities of a framework through the application programming interface (API), which is published by the framework through its header files. Because the library is dynamically shared, multiple applications can access the framework code and resources simultaneously. The system loads the code and resources of a framework into memory, as needed, and shares the one copy of a resource among all applications.

来自框架编程指南:什么是框架?:

与静态链接库和其他类型的动态共享库相比,Frameworks具有以下优点:

Frameworks offer the following advantages over static-linked libraries and other types of dynamic shared libraries:

  • Frameworks将相关但独立的资源分组在一起.此分组使安装,卸载和定位这些资源变得更加容易.
  • 与库相比,Framework可以包含更多种资源类型.例如,框架可以包括任何相关的头文件和文档. 框架的多个版本可以包含在同一捆绑中.这样就可以与较旧的程序向后兼容.
  • 在任何给定时间,只有一个框架的只读资源的副本在物理上驻留在内存中,无论有多少进程正在使用这些资源.这种资源共享减少了系统的内存占用,并有助于提高性能.
  • Frameworks group related, but separate, resources together. This grouping makes it easier to install, uninstall, and locate those resources.
  • Frameworks can include a wider variety of resource types than libraries. For example, a framework can include any relevant header files and documentation. Multiple versions of a framework can be included in the same bundle. This makes it possible to be backward compatible with older programs.
  • Only one copy of a framework’s read-only resources reside physically in-memory at any given time, regardless of how many processes are using those resources. This sharing of resources reduces the memory footprint of the system and helps improve performance.

相关问题

您可能希望查看 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆