本文介绍了iOS中的框架内部包含静态或动态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到过多个站点,它们描述了框架既可以包含静态库又可以包含动态库.但是,如何确定框架实际包含的是动态库还是静态库.我想到先使用扩展名(.a用于静态库,.dylib用于动态库),但是在我正在试验的框架内,我所看到的就是对打包在其中的二进制文件未提供任何扩展名.有什么办法可以找到它是静态库还是动态库.

I have come across multiple sites describing that frameworks can contain both static as well as dynamic library. But how do I identify if what the framework actually contains is a dynamic library or a static library. I thought of first taking help of extension (.a for static library, .dylib for dynamic library) but all I could see inside the framework that I was experimenting was that no extensions were provided for the binary file that was packaged inside. Is there any way I can find whether it's a static library or a dynamic library.

我还阅读了Landon Fuller在静态库中的帖子 http://landonf .bikemonkey.org/code/ios/Radar_15800975_iOS_Frameworks.20140112.html 他提到了框架为库提供了两个级别的命名空间,但它是否涵盖普通的调试符号,而不仅仅是依赖关系,甚至对框架内封装的静态库也有效.

Also I have read Landon Fuller's post on static libraries http://landonf.bikemonkey.org/code/ios/Radar_15800975_iOS_Frameworks.20140112.htmlin which he mentions that frameworks provide two level namespace for libraries but does it cover normal debug symbols and not just dependencies and does it work even for static libraries packaged inside frameworks.

E.x.如果我在框架内以及链接到的项目代码库中具有相同的调试符号,会发生什么情况.在这种情况下,两层名称空间是否可以工作.

E.x. what happens if I have the same debug symbol inside a framework as well as in the project codebase to which it is linked. Will two level namespace work in that scenario.

根据该作者的说法 http://ddeville.me/2014/04/dynamic -链接/框架是包含动态库,头文件和资源的捆绑包或软件包.

Also according to this author http://ddeville.me/2014/04/dynamic-linking/framework is a bundle or package containing a dynamic library, header files and resources.

根据以下帖子图书馆?静态的?动态的?还是框架?在另一个项目中进行项目它说框架可以同时包含静态和动态库.

As per the following post Library? Static? Dynamic? Or Framework? Project inside another projectit says frameworks can contain both static as well as dynamic libraries.

对此我感到很困惑.有人可以用两层名称空间来说明iOS中的框架及其包含的内容以及它们如何工作.

I am so confused by this. Can somebody explain framework in iOS as to what they contain and how they work in terms of two level namespace.

推荐答案

很容易确定文件扩展名何时显式

It is simple determine when a file extension is explicit

  • .a-静态库
  • .dylib-动态库
  • .a - static library
  • .dylib - dynamic library

您可以使用 file 命令

you can use file command

file /some_path/<framework_name>.framework/<framework_name>

//possible results
current ar archive random library //static library
dynamically linked shared library //dynamic library

可以在构建设置中更改它Mach-O type Static Library targetDynamic library,将生成.a文件,file命令显示dynamically linked shared library,但它将是静态库

It is possible to change it in Build Settings a Mach-O type from Static Library target to Dynamic library and .a file will be generated, file command show you dynamically linked shared library but it will be static library

[词汇]
[静态与动态框架]

这篇关于iOS中的框架内部包含静态或动态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-11 10:01