Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode AppIcon based on scheme

I'm aware that you can change the AppIcon based on build targets, so some people create dev, staging, release build targets with different AppIcons like this article suggests: Different App Icons for your iOS Beta, Dev, and Release builds

However I would like to do this by schemes if possible.

I have 4 build targets:

  • Dev
  • QA
  • Staging
  • Release

And many schemes, which using react-native-config I can build different flavors based on environment variables:

  • Public
  • Public Premium
  • B2B
  • B2B Premium

Using schemes I can have many versions of the app at once on a device using the BundleID which gets changed using react-native-config.

How can I use schemes to differ the AppIcon?

like image 206
ZeroBased_IX Avatar asked Dec 12 '17 10:12

ZeroBased_IX


1 Answers

If you're already using 'Environment Variables' to modify things like Bundle Identifier, you could totally do the same for AppIcons.

I don't know a lot about React Native configuration but in Xcode you can edit Target's build settings easily. For demonstration purpose I've create a test project and added a 'Premium' Configuration.

For instance if I would like to change the Bundle Identifier on my test project. I need to go under Target > Build Settings and search For 'Product Bundle Identifier' here I can set a different bundle id for each config.

Screenshot 1

The exact same mechanic apply for App Icons. To find the setting I must go under Target > Build Settings once again and search for 'Assets Catalog Compiler - Options' under this one I look for another options called 'Asset Catalog App Icon Set Name' and here you can chose a different Icon for any configuration. Here I chose AppIcon-Premium for my Premium config

Screenshot 2

Of course you need to create another IOS App Icon

Screenshot 3

Screenshot 4

I am conscious that for this example I am using Configuration over Schemes, but for me a Scheme is just a quick way to switch between configurations.

Here is a StackOverflow thread about Schemes and Configurations differences: understanding Xcode schemes

I hope this answer could help you at least a bit. I recently spent so much time struggling to understand Xcode mechanics... However I am still a Newbie and I am probably missing a lot of things. Even if you're still stuck I hope that my answer could help you to improve your search !

I wish you best of luck !

like image 174
Charles Pernet Avatar answered Oct 26 '22 06:10

Charles Pernet