如何创建混合Xcode项目Mac&苹果手机? [英] How do you create hybrid Xcode projects for Mac & iPhone?

查看:103
本文介绍了如何创建混合Xcode项目Mac&苹果手机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个包含两个目标的项目。一个用于构建在Mac开发中使用的框架,另一个用于创建在iPhone开发中使用的静态库。

I'm working on a project which shall contain two targets. One for building a Framework to use in Mac development and another to create a static library to use in iPhone development.

在普通代码中,#ifdef平台,但我只是不能得到目标和依赖关系。

In the common code it's no problem to #ifdef between the platforms, but I just can't get the targets and dependencies right.

第一个问题是,哪个基本的SDK使用?
例如,如果我使用Mac 10.5我不能包括UIKit框架(它被标记为红色,如果我展开它不显示头文件)。即使目标实际上链接到它构建的iPhone操作系统。

The first question is, which base SDK to use? For example if I use Mac 10.5 i can't include the UIKit framework (it is marked red and doesn't show the header files if i expand it). Even if the target that actually links against it builds for iPhone OS..

另一个问题是,Foundation.framework,或像Security.framework的东西?如何处理它们,因为我只能包括一个版本(Mac或iPhone SDK)...

The other question is, how about the Foundation.framework, or stuff like Security.framework? How to deal with them, as I can only include one of the versions (Mac or iPhone SDK)...

任何人都有我的建议?
我想有一个干净的项目结构和绝对相同的代码库两个目标...配置的方式去?

Anyone has an advice for me? I'd like to have a clean project structure and definitely the same codebase for both targets... Are configurations the way to go?

谢谢! / p>

Thanks!

推荐答案

只是为了让您知道:

项目与不同平台的不同目标。
但是我没有在目标本身中包括我依赖的框架,而是将它们添加到其他链接器标记构建设置:

I ended up having one project with different targets for the different platforms. But I didn't include the framework I depend on in the targets itself, but rather added them to the Other Linker Flags build settings:

-framework Foundation -framework Security

请在我在 github 上执行的项目中查看。

You can check it out in the project I did on github.

这篇关于如何创建混合Xcode项目Mac&苹果手机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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