Add how to documentation for build configuration based setup

This commit is contained in:
Andreas Linde 2012-08-05 14:29:17 +02:00
parent 90759c7788
commit 3ce5806f95
4 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,41 @@
## Introduction
It can be useful to use a different setup depending on your Xcode build configuration, e.g. disable Beta Update checks in Debug builds.
To do that, we recommend to define a preprocessor macro for all configurations and use compiler directives to setup the SDK depending on the currently used build configuration.
**Note:** Beta Update checks is automatically disable when the SDK detects it is running in an App Store build. So you don't have to do anything in that scenario!
## HowTo
1. Select your project in the Project Navigator.
2. Select your target.
3. Select the tab "Build Settings".
4. Enter "preprocessor macros" into the search field.
![XcodeMacros1.png](XcodeMacros1_normal.png)
5. Select the top-most line and double-click the value field.
6. Click the + button.
7. Enter the following string into the input field and finish with "Done".<pre><code>CONFIGURATION_$(CONFIGURATION)</code></pre>
![XcodeMacros2.png](XcodeMacros2_normal.png)
Now you can use `#if defined (CONFIGURATION_ABCDEF)` directives in your code, where `ABCDEF` is the actual name of your build configuration.
**Note:** Make sure to use build configuration names without spaces!
## Example
#if defined (CONFIGURATION_Debug)
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"<>"
delegate:nil];
[[BITHockeyManager sharedHockeyManager] setDisableUpdateManager:YES];
#else
[[BITHockeyManager sharedHockeyManager] configureWithBetaIdentifier:@"<>"
liveIdentifier:@"<>"
delegate:nil];
#endif
[[BITHockeyManager sharedHockeyManager] startManager];

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

View file

@ -30,6 +30,7 @@ HowTos
- [How to do app versioning](HowTo-App-Versioning)
- [How to upload symbols for crash reporting](HowTo-Upload-Symbols)
- [How to handle crashes on startup](HowTo-Handle-Crashes-On-Startup)
- [How to do Xcode build confugration based SDK setup](HowTo-Configuration-Based-Setup)
Troubleshooting
===============