0

I created two versions of my iOS app with Xcode 6 : free and paid. To visually differentiate one from the other I use different background colors : the free version is orange while the paid version is red. I am using one single project for both versions, and a global boolean variable changes the entire app from free to paid (and vice versa).

Of course, all the icons must be different too. I need two appicon sets: one full with orange icons, and the other with red icons.

So my problem is: how to programmatically switch between two appicon sets at runtime? How to tell my project that, if the global variable is false, use the orange icons set, and if it is true use the red icons set?

Next image ilustrate the two appicon sets, but how to call them in-code?

enter image description here

The idea is that, if by the end of the month you forget to pay your subscription, the app becomes orange, then you visually realise you forgot to pay, and after you pay the app turns red again.

  • Sorry this functionality is just impossible to have you'll have to create a paid version and a free version with a flag similar to what `Cornelius` has suggested. – Popeye Mar 09 '15 at 16:40
  • you can implemented anytime a custom theme manager in to your app, but switching between the assets is not really supported at the moment as you'd desire. – holex Mar 09 '15 at 16:52
  • 1
    Possible duplicate of [Can I change app icon programmatically](http://stackoverflow.com/questions/10042275/can-i-change-app-icon-programmatically) – ymutlu Jan 25 '17 at 12:33
  • Since `iOS 10.3` this is possible! http://stackoverflow.com/questions/41950994/is-this-possible-to-apply-the-alternative-icon-to-the-ios-application – KlimczakM Apr 03 '17 at 11:33

3 Answers3

2

You can try below method introduced in iOS 10.3 https://developer.apple.com/reference/uikit/uiapplication/2806818-setalternateiconname

0

Short answer: You can't do that.

Long answer: Supposed you want to have one paid app and one free app (in contrast to one free app with in app purchases) you should use different targets for your free and paid version. You can use different info.plist files for each target and in those file specify the image to use as the app icon. Also you can change the app and bundle name there, so that you have two different apps on the App Store.

Add a preprocessor macro that identifies your target, you can then use that in your code to define the differences at compile time:

#ifdef LITE_VERSION
    [self showAds];
#else
    [self showUsefulInformation];
#endif
Cornelius
  • 4,214
  • 3
  • 36
  • 55
0

Apple don't allow the switching of App icons during runtime. So it is not possible to switch between the App icons. If you need to do it create two apps in iTunesConnect with different app names.

abintom
  • 1,008
  • 7
  • 6