开发者

How can I create two projects, using the same source with a different App Name and info.plist?

Actually, my iOS App contains multiples version in the same project, changed with a #define in a Static Class.

Example:

#import "AppVersion.h"

//...

if (MYAPP_VERSION == kMyAppVersionFree) {
   //Limited features
}
else if (MYAPP_VERSION == kMyAppVersionFull) {
   //No limit !
}

Each time I want to compile, I have to edit my code to change the #define MYAPP_VERSION, and change the project name, to be able to release a MyApp and "MyApp Free" executables...

Is it possible to define this as a "compilation variable"? I don't want to have to edit my code each time I want to compile 2 versions

How开发者_JAVA百科 can I create 2 projects, using exactly the same source (many classes) but with a different App Name and a different info.plist (and, relative to previous question, different "compilation variables")?

I'm asking for a different info.plist because my "Free version" doesn't support iTunes file sharing, but my "Full version" does...

Any idea? How do you manage versions in your projects?


You need to define targets for your various versions.

Click on the root of your project (the blue xcode icon). You will see your project settings in a table. On the left hand side you will see a "TARGETS" heading, with one child, the name of your project.

You can right click the target and duplicate it. Once you have a duplicate, you can rename it and then configure it's settings separately. One of the project settings are the GCC Preprocessor values. You can define LITE or FULL variables based on your target and then use #ifdefs in your code to do conditional compilation.

You can add different pList files for different targets. Just right click on the pList files and include or exclude the files for each target.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜