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

查看:82
本文介绍了如何从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.

推荐答案

A * .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:

  • https://github.com/xamarin/monotouch-samples/tree/master/BindingSample

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

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

  • http://docs.xamarin.com/ios/advanced_topics/binding_objective-c_types

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

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