如何从 iOS 中的现有框架创建静态库? [英] How to create static library from an existing framework in iOS?

查看:25
本文介绍了如何从 iOS 中的现有框架创建静态库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第三方供应商为我提供了 iPhone 硬件配件的框架.所以我有一个像 Device.framework 这样的文件夹.该文件夹内是一个二进制文件和一组 .h 文件.有关于如何将其添加到 iOS 项目并使用其中包含的类的说明.但是,我实际上使用的是 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.

有没有办法创建一个静态库,使框架中的所有类都可以在静态库中使用?因此,在我的 MonoTouch 项目中,我将链接静态库并访问该框架.

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.

推荐答案

*.framework 只是一个包,其中包含:静态库、头文件、关联的元数据.复制并粘贴 .framework 并提取静态 *.a 文件和相关头文件.

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.

然后只需使用 MonoTouch btouch 工具绑定静态库以在您的 MonoTouch 项目中使用即可.在 Github 上有一个很好的示例说明如何将本机库绑定到 MonoTouch.指导针对模拟器 + 设备并使用 LinkWith 属性将静态库嵌入到单个 *.dll 中:

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:

另外,请务必在此处查看 btouch 参考文档:

Also, make sure to check out the btouch Reference documentation here:

这篇关于如何从 iOS 中的现有框架创建静态库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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