如何基于一个xcode项目构建Lite和完整版iPhone应用程序? [英] How to build both Lite and Full version of iPhone app based on one xcode project?

查看:117
本文介绍了如何基于一个xcode项目构建Lite和完整版iPhone应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想维护两组代码。我只需要限制Lite版本中的一些功能并在其上添加一些广告。

I do not want to maintain two sets of code. I just need to limit some features in the Lite version and add some advertisements on it.

如何做到这一点?

推荐答案

创建多个目标。

您可以通过右键单击目标并选择获取信息来改变构建配置。从那里,你可以做一些事情,比如改变它正在查看的 Info.plist 文件(做一些事情,比如在名称中添加Lite并更改图标/加载图像)并设置编译器标志,以便你可以在地方 #ifdef

You can vary build configurations by right-clicking on a target and selecting Get Info. From there, you can do things like change which Info.plist file it's looking at (to do things like add "Lite" to the name and change the icon/load images) and set compiler flags so that you can #ifdef in places.

如果有很多文件只是适用于完整版,然后您可以右键单击它们并从Lite目标中删除它们以制作更小的应用程序。

If there are lots of files that are only applicable in the full version, then you can right-click on them and remove them from the Lite target to make a smaller app.

我已经尝试了各种替代方案,比如多种配置,我不断回到多个目标。我通常至少有三个定义 - 开发,Ad hoc和App Store,每个都有自己的特定设置。

I've experimented with various alternatives, such as multiple configurations, and I keep coming back to multiple targets. I usually have at least three defined - Development, Ad hoc and App Store, each with their own particular settings.

这篇关于如何基于一个xcode项目构建Lite和完整版iPhone应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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