困惑关于在Xcode 6中创建一个胖静态库的不同的过程 [英] confused about different procedures for creating a fat static library in Xcode 6

查看:182
本文介绍了困惑关于在Xcode 6中创建一个胖静态库的不同的过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对我发现的关于如何使用最新的Xcode 6和iOS 8环境创建通用框架的信息感到困惑。例如,关于使用构建阶段运行脚本创建聚合目标,这是我在先前版本的Xcode中熟悉的。当我使用这个过程,我收到我所期望的。文件夹结构如下:





有人可以帮助我们澄清这个混乱吗?



两者之间有什么区别?



我的意思是,第一个创建应用程序的程序可以在模拟器和设备上运行,第二个是创建 > 的重要区别在于 >和框架。框架只是一个包含您的库和标题的特定文件夹结构。



lipo组合了。因此,指令有一个示例执行,引用您已经构建的框架(一次为iphoneos,一次为模拟器)。框架之间的唯一区别是库,所以通过使用lipo来组合库,你会得到一个胖(或更胖)库和所有支持的框架。



回答告诉你如何创建一个框架和一个应用程序。只需担心框架部分。使用不同的目标(iOS设备和模拟器)构建框架两次。确保您'Build Active Architecture Only'设置为'No'。您可能需要为发布而不是调试而构建,但这取决于您的具体需求。


I'm a little confused about information I am finding about how to create a universal framework using the latest Xcode 6 and iOS 8 environment. For instance, this answer includes the following:

If you need to create universal static library that runs on both simulator and devices, then general steps are:

 1. Build library for simulator  
 2. Build library for device  
 3. Combine them using lipo

lipo -create -output "framework-test-01-universal" "Debug-iphonesimulator/framework-test-01.framework/framework-test-01" "Debug-iphoneos/framework-test-01.framework/framework-test-01"  Note that framework-test-01 is my framework project name.

One of my coworkers followed those instructions and build an executable. Well, I don't think that is what I am looking for. It contains a structure that looks like this:

Later on, another answer here talks about creating an Aggregate Target with a Build Phase Run Script, which is what I am familiar with in the previous version of Xcode. When I use that process I receive what I am expecting. A folder structure as follows:

Can someone please help clear up this confusion we are having?

What is the difference between the two?

I mean, is the first procedure for creating an application that can run on both the simulator and the device, while the second is for creating a fat static library?

解决方案

The important distinction is between the library and the framework. The framework is just a specific folder structure that contains your library and headers.

lipo combines libraries. So the instructions have a sample execution that refers to the library inside of a framework you have already built (once for iphoneos, once for the simulator). The only difference between the frameworks is the library, so by using lipo to combine the libraries you get a fat (or fatter) library with all supported frameworks.

That first linked answer tells you how to create both a framework and an app. Only worry about the framework part. Build the framework twice with different targets (an iOS device and a simulator). Make sure that you 'Build Active Architecture Only' is set to 'No'. You'll probably want to build for release rather than debug, but it depends on your specific needs.

这篇关于困惑关于在Xcode 6中创建一个胖静态库的不同的过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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