0

I have a mobile app developed for number of different companies on AppStroe. Each company is using different endpoint to server/icon/logo. I have managed to add this in custom plist file and according to companies endpoint, I switched to different build setting.

Now these companies are going to different ways of authentication. One is using another app to authenticate and one is using server calls. Also for one company I am receiving datas one from server call and other one from local files.

I have to handle different login behaviour for different projects. It is mostly display/disable some extra views. I don't want to have two repositories or branches. Because almost %85 of functionalities are same. I want to add functionalities same time to both and some times to only one of them and run my tests and all.

I am looking for some way way to manage this app to maintain most functionalities and keep it only one app. How can I do that? Any suggestion?

Bernard
  • 4,240
  • 18
  • 55
  • 88
  • Making multiple branches is a solution that Git can provide. I know little about iOS dev. We have a software for several different customers. We define a group of keys, one for each customer. Every key can enable its corresponding functionalities, which are disabled by default. In the release version, the key can only be written once. – ElpieKay May 25 '16 at 13:50
  • @ElpieKay if I use different branches for different customers then if I want to add one functionality to all customers I must do it in all branches one by one! Is there any better solution given by Git? – Bernard May 25 '16 at 22:46
  • You could change the code and `git commit` in one branch, and then `git cherry-pick` the commit to other branches that need it. Commit once, apply everywhere. The problem is you need to release the app with the code of every branch. – ElpieKay May 26 '16 at 00:09

1 Answers1

1

This is a very old problem. Basically you have two options: build time and run-time; from your description it may be that you need a both (I would not trust configuration to drive my authentication code).

Build time means using conditional compile (e.g. Which conditional compile to use to switch between Mac and iPhone specific code?) and a different build profile for each customer. I assume that Xcode Targets (see How to manage the code of multiple, very similar Xcode projects) allows you to define different build profiles.

Run-time checks maps to Feature Toggling.

I suggest not using version control to manage nuances of the same application because it quickly becomes a merge nightmare, even with Git.

Community
  • 1
  • 1
Giulio Vian
  • 8,248
  • 2
  • 33
  • 41
  • Your answer doesn't cover how to provide different content for each different build, as surely you aren't advocating putting all the assets for all the different customers into the same app bundle and using conditional compilation or runtime checks to decide what to display? – trojanfoe May 26 '16 at 07:21
  • I am not an expert in Xcode but build systems are build systems. Seems that target is the proper term for a build profile, editing the answer accordingly. – Giulio Vian May 26 '16 at 08:15
  • 1
    Absolutely correct. You would have one project with multiple targets. Each target would share the same source files, with conditional compilation to control functional changes (with target build settings setting the conditional macro), but you would provide different assets for each target which are unique to that build. – trojanfoe May 26 '16 at 08:18