如何为iPhone模拟器和设备构建库? [英] How to build a library for both iPhone simulator and device?

查看:232
本文介绍了如何为iPhone模拟器和设备构建库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为iphone构建一个静态库。我想给我的用户一个.a库,他们可以用它来进行模拟器测试和设备测试。我是否必须在模拟器模式和设备模式下构建两个库?有没有办法构建一个可以用于两个平台的单个?

I want to build a static library for iphone. I want to give my users the .a library which they can use for both simulator test and device test. Do I have to build two library in simulator mode and device mode? Is there any way to build a single one that can be used for both platforms?

推荐答案

编译你的库两次。使用设备SDK后,再次使用模拟器SDK。

Compile your library twice. Once using the device SDK, and again using the Simulator SDK.

然后使用 lipo 命令行工具创建一个胖库。

Then use the lipo command line tool to create a "fat" library.

lipo -create libdevice.a libsimulator.a -output libcombined.a

这应该可以满足您的需求。

That should give you what you need.

这篇关于如何为iPhone模拟器和设备构建库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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