Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install two versions of same iOS app

Tags:

ios

branding

I am developing an iOS-application which is supposed to be branded to different customers. The issue at hand is that I need two versions of the application (one with orange theme and one with red theme) installed at the same time. What would be the best approach for accomplishing this?

like image 319
user1354603 Avatar asked Oct 31 '13 15:10

user1354603


People also ask

Can you have 2 versions of the same app on iPhone?

Creating a duplicate copy of an app icon is easy. Find the app in the App Library, then drag a new copy of it onto your Home Screen: Swipe to the App Library at the right edge of all your Home Screens. Look through the various folders or use the Search bar to find the app you want to duplicate.

Can I have two versions of the same app?

To make it clear, the feature to make multiple copies of an app is only available on certain Android devices. You should find this feature on Samsung, Xiaomi, and OnePlus phones. If your phone doesn't have this feature, you can still run multiple instances of your Android apps using a third-party app.

How do I install the same app as a different version?

you can use an app called parallel space by which u are able to install same app twice on same device. install “parallel space” you can install one version in that application and one that is already installed on your phone . make sure that you have setup of both the applications that you want to install.

How do I install an older version of an app on an old iOS?

Log in to the same Apple ID on your old iPhone, iPad, or iPod touch. Go to App Store and tap My Purchase to find the app you want to install. Tap the cloud icon on the right side to download it on your old Apple device.


2 Answers

You will simply need to use two different bundle-identifiers. This can be set in the info.plist: CFBundleIdentifier. You may want to setup different target or schemes that use different versions of the info.plist.

like image 108
Felix Lamouroux Avatar answered Sep 20 '22 03:09

Felix Lamouroux


I prefer to do this without maintaining two separate plist files, by post-processing the plist file in a custom "Pre-actions" build script for the "Archive" operation.

This helps to avoid problems where someone forgets to update both plist files when changing something.

I use this mechanism for building test versions of the app which I can upload to TestFlight so that my testers can have both the live version and the current test version installed simultaneously.

(note: Although this script goes in the "Pre-actions" section, it's really a post-processing step because it happens after XCode has done all of the variable substitution into the plist file)

To set this up (these instructions are for XCode 5.0.1), duplicate your existing scheme and call it something appropriate.

Select "Edit scheme", and expand the "Archive" item in the left tab. This should give you "Pre-actions", "Archive" and "Post-actions" sub-items. Click on the "Pre-actions" one, and then in the right tab, click on the '+' at the bottom to add a new "Run Script Action".

I use Ruby for my build scripts, so I enter "/usr/bin/ruby" in the "Shell" box at the top, but you can obviously do the same thing in bash or similar.

Select your project in the "Provide build settings from..." dropdown.

Then you can paste in some variant of the following code in the box at the bottom (or put it in a file, and drag the file to the box):

def changeBundle(file)
    oldId = `/usr/libexec/Plistbuddy -c "print :CFBundleIdentifier" #{file}`.strip
    system("/usr/libexec/PlistBuddy -c \"Set :CFBundleIdentifier #{oldId}_test\" #{file}")

    oldName = `/usr/libexec/Plistbuddy -c "print :CFBundleDisplayName" #{file}`.strip
    system("/usr/libexec/PlistBuddy -c \"Set :CFBundleDisplayName #{oldName}-Test\" #{file}")
end

changeBundle("#{ENV['CODESIGNING_FOLDER_PATH']}/Info.plist")

This updates the CFBundleIdentifier (adding '_test'), and the CFBundleDisplayName (adding '-Test') so that the apps are visibly different. Customise to make whatever changes you require.

The reason that the code to change the file is in a function is so that it's easy to make the same change to several plist files if you need to.

You don't need to do that in this case (because you probably just want to change what goes into the output archive file), but some of my other build scripts update version numbers automatically, and I want those changes to be checked into git. If you need to do that sort of thing, you can modify the source plist file as well by adding this at the bottom:

changeBundle("#{ENV['PROJECT_DIR']}/#{ENV['INFOPLIST_FILE']}")
like image 21
sheltond Avatar answered Sep 23 '22 03:09

sheltond