如何从 iOS 中的现有框架创建静态库?
第三方供应商向我提供了 iPhone 硬件配件的框架。所以我有一个类似 Device.framework 的文件夹。该文件夹内有一个二进制文件和一组 .h 文件。有关如何将其添加到 iOS 项目并使用其中包含的类的说明。但是,我实际上正在使用 MonoTouch 并且想要使用静态库。
有没有办法创建一个静态库,使框架中的所有类都可以在静态库中使用?因此,在我的 MonoTouch 项目中,我将链接静态库并可以访问该框架。
I have been provided with a framework by a third party vendor for an iPhone hardware accessory. So I have a folder like Device.framework. Inside that folder is a binary file and a set of .h files. There are instructions for how to add this to an iOS project and use the classes contained within. However, I'm actually using MonoTouch and want to use a static library.
Is there a way to create a static library that makes all the classes from the framework available in the static library? So in my MonoTouch project I would link in the static library and have access to that framework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
*.framework 只是一个包,其中包含:静态库、标头、关联的元数据。复制并粘贴 .framework 并提取静态 *.a 文件和相关头文件。
然后只需使用 MonoTouch btouch 工具绑定静态库即可在您的 MonoTouch 项目中使用。 Github 上有一个很好的示例,说明如何将本机库绑定到 MonoTouch。有关定位模拟器 + 设备并使用 LinkWith 属性将静态库嵌入到单个 *.dll 中的指导:
另外,请务必在此处查看 btouch 参考文档:
A *.framework is simply a package containing: the static library, headers, associated meta data. Copy and paste the .framework and extract the static *.a file and related header files.
Then it's simply a matter of using the MonoTouch btouch tool to bind the static library for use in your MonoTouch project. There is a great example of how to bind a native library to MonoTouch on Github. With guidance on targeting simulator + device and using the LinkWith attribute to embed the static library in a single *.dll:
Also, make sure to check out the btouch Reference documentation here:
将该二进制文件重命名为
Device.a
。你可以这样做,因为你提到的框架不是由苹果公司完成的,因此它必须是一个静态库而不是动态库。确保您的项目链接该库 (
Device.a
)。在您的项目中包含标题并在适当的情况下引用它们。
Rename that binary file to
Device.a
. You can do that as the framework you mention is not done by Apple, hence it has to be a static library and not a dynamic one.Make sure your project links that library (
Device.a
).Include the headers in your project and reference them where appropriate.