10

Using Xcode (to develop on iOS) I want to create a second project that it is the same as a first project but some classes are differents.

Exactly, I'm creating an IPhone App and I want to offer a free version and a premium version. Actually, the code of the projects are identical but changes some classes.

The problem is I don't want support two projects. If I modify a class, then I have to modify the same change on the other project. It is very redundant.

Besides, the project are pushed to a remote GIT respository.

And one last note, an iOS App is identify using an ID associated with the project.

So, I need two differents projects?

Which is the best solution to create two iOS App projects in Xcode sharing the classes, but changing two o three classes?

Thanks

Tim
9,0624 gold badges45 silver badges64 bronze badges
asked Apr 15, 2013 at 16:08

3 Answers 3

19

I want to offer a free version and a premium version.

In this case, you do not need to create two apps in two projects: all you need is a second target for your premium version. Here is a link that explains how to create and manage multiple targets in Xcode.

The process boils down to adding a target to the project, defining a separate properties plist for it, optionally setting up a preprocessor symbol for conditional compile, and using that symbol to #ifdef portions of your classes not needed in the free version.

Another common approach to managing free vs. premium offering is to provide a single version for free, and let users upgrade it to premium through an in-app purchase.

answered Apr 15, 2013 at 16:12
Sign up to request clarification or add additional context in comments.

Comments

6

You just have to create two targets. So you'll only modify a single code base, perfect!

This tutorial will walk you through (and even uses lite/paid versions as it's example).

answered Apr 15, 2013 at 16:13

Comments

0
  1. duplicate target of paid version and name it free version

  2. define macro name PaidApp=1 in paid target, then put this line of code in starting of applicationDidfinishLaunching.

    #ifdef PaidApp
    [[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"adDisabled"];
    #endif
    
  3. when free app running target, if someone purchase paid app feature then set value of @"adDisabled" to 1 (by default value of @"adDisabled" will be 0)

marc_s
760k186 gold badges1.4k silver badges1.5k bronze badges
answered Dec 29, 2016 at 12:18

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.