I as an iOS developer, face some situations like someone comes to me and says, “Hey, the app crashes, look at that” Assume that I have two versions installed from testflight or app store. I ask, “Which version is it?” and the answer might be “I don’t remember” I wanted to solve this problem without asking any question to the person who comes to me. Also, I wanted to add some controls where the app installed like testflight, app store or via Xcode. I wished to separate the versions with configuration. The answer is schemes.
When creating a new project, debug and release configurations comes automatically.
I prefer to add one more configuration, which is called Test. It duplicates from “release”. Let’s click plus button where it is below the release configuration and select Duplicate Release Configuration.
Why we need Test configuration?
Debug is for developers.
Release is for the AppStore.
Test is for testers.
Configure the App
Let’s start with the name of the app. Go to the Build Settings and search with the product name.
Change the names by configuration.
So, the question is, how can I run the app by configuration? Let’s manage the schemes!
Click the plus button where on the bottom-left and create 2 more schemes. Change the names of the schemes Debug, Release, Test. To give a name, click the scheme name.
Open the debug scheme clicking double times over the scheme name. Select configurations as Debug.
The selective configurations are in Run on Info tab as Build Configuration, in Test on Info tab as Build Configuration, in Profile on Info tab as Build Configuration, in Analyze as Build Configuration, in Archive as Build Configuration.
The build configurations must be Debug for the Debug scheme, Test for the Test scheme and Release for the Release scheme.
Let’s select the Debug scheme and run the app.
When the app runs, you see the app name is Debug.
What is Next?
We will change bundle id, app icon, base API URL by configuration in the next story.
The next story: Managing Configurations 2
Keep following for more!
Note: Please comment if any correction or better way exists then you can help everyone.