how to manage 2 version of a single app for different regions and languages?

app-store, cocoa, git, ios, xcode

Solution

Per our discussion, it is suggested to use Targets in the same project, the code is reused and can be checked in to one repo. Following is what I would do to maintain multiple Targets within the same project.

In Target `US` Build Settings, Preprocessor Macros, add following:

TARGET='TARGET_US'

In Target `China` Build Settings, Preprocessor Macros, add following:

TARGET='TARGET_CN'

Then in code, use preprocessors to check:

#define STRINGIZE(str) #str
#define STRINGIZE_MACRO(str) STRINGIZE(str)

#ifdef TARGET
    if (STRINGIZE_MACRO(TARGET)=="TARGET_US") {
        // US app logic goes here
    } else if (STRINGIZE_MACRO(TARGET)=="TARGET_CN") {
        // China app logic goes here
    }
#endif

Also just want to point out that there is a way of associating Compiled source files with Targets, it is found in Build Phases. You can make a selection of code files that is needed to compile. E.g for Target `US`, Add main-us.m and USAppDelegate.m for compilation, for Target `China` use main-china.m and ChinaAppDelegate.m.

Problem

I am deploying an iOS application in both US and China. App behaves pretty much the same but has slightly different logic. For example: we use email to register account but use phone number in China. Other than this obviously the languages used in app are different. We are going to submit two different apps to US and China app store but we have this problem: two versions share considerable amount of code base(95%). That being said if in the future we ever need to add future to the app we have to manually migrate changes since we won't be able to use git(I assume so because they are different projects right?). This is surely not desirable. But by now I see no way to go around it. Can any one offer any suggestions about approaching such issue? Maybe there is a git trick? Or we should not use two different projects in the first place? If not, what's the better way? Thanks in advance.

Original source