# Exclude SDK from iOS Production Builds

> Exclude the Applivery SDK from your iOS production Builds using Xcode configurations and compiler flags to prevent App Store rejection.

Source: https://docs.applivery.com/en/app-distribution/platforms/apple/exclude-sdk-ios-production/  •  Last updated: 2026-04-18

**Key topics:** Xcode Configuration Files, Build Settings, Compiler Flags, Conditional Compilation, Applivery SDK Exclusion, Applivery SDK, iOS, Xcode, Apple App Store, Google Play

---

**TL;DR:** Exclude the Applivery SDK from your iOS production builds using Xcode configurations and compiler flags to avoid App Store rejection.

As you may already know, it’s not allowed to use the Applivery SDK in production Apps that are released in the official Apps Stores (Google Play and Apple App Store). In addition, it is a practice that we do not recommend, and that could cause the rejection of your App during the review process.

This tutorial will guide you through the process of conditionally excluding the Applivery SDK based on the Environment of the App (i.e., Live, Test, Staging, or Quality).

:::info
For the purpose of this tutorial, we are considering that you already know the basics of how to manage different environments by using Schemas and Configurations. If not, we recommend taking a look at the following [blog post](https://www.freecodecamp.org/news/managing-different-environments-and-configurations-for-ios-projects-7970327dd9c9/).
:::

**Create Configuration Settings Files (.xcconfig) for Each of Your Environments**

Go to **File > New > File… (Command + N) -> Configuration Settings file** and choose a descriptive name for your configuration file. For this example, we will create two different Configuration Files: one for the development environment (`DEV.xcconfig`) and another one for the production environment (`PROD.xcconfig`).

**DEV.xcconfig**

```
// App Info
APP_NAME = My Awesome App [DEV]
BUNDLE_IDENTIFIER = com.acme.awesome.dev

// Environment
ENVIRONMENT = DEV

// Applivery Options
APPLIVERY_TOKEN = b7C...2I6
```

**PROD.xcconfig**

```
// App Info
APP_NAME = My Awesome App [PROD]
BUNDLE_IDENTIFIER = com.acme.awesome.prod

// Environment
ENVIRONMENT = PROD

// Applivery Options
APPLIVERY_TOKEN = 1gxC...66f
EXCLUDED_SOURCE_FILE_NAMES = Applivery.framework
```

Since we do not want the Applivery SDK to be included in the Production Environment, we have added the following line of code `EXCLUDED_SOURCE_FILE_NAMES = Applivery.framework` that will exclude the source files of the Applivery SDK during the process of building the App.

Additionally, we will take advantage of this Configuration File to also define a different Applivery SDK Token for each of the environments.

**Link the Configuration Files with Your Project Schemas**

Now that we have multiple configuration files that describe the particularities of your Environments, it’s time to link them with your project Schemas. To do so, under your **Project Configurations settings**, select the appropriate Configuration File by using the **Build Configurations** dropdown menu.

![ios-sdk-configurations-002 | Applivery](https://docs.applivery.com/int/_r2/media/09ac0a4e-3ad8-478f-9f15-3474973eec71/4b937ac6-bcfa-44a2-bd33-d5469e2c6cad.png)

**(Optional) Use Configuration File Variables in Your Code**

![ios-sdk-configurations-003 | Applivery](https://docs.applivery.com/int/_r2/media/09ac0a4e-3ad8-478f-9f15-3474973eec71/a4d9fc97-2ef7-4354-9d7a-19f3d584b8ca.png)

Additionally, to use the `Info.plist` **Keys** in your code, you can follow the next approach:

```swift
// Get values from Info.plist
public func InfoDictionary(_ key: String) -> String {
  guard let constant = Bundle.main.infoDictionary?[key] as? String else {
    return "CONSTANT NOT FOUND"
  }
  return constant
}

// Example of usage of the above function when starting the Applivery SDK
applivery.start(token:InfoDictionary("APPLIVERY_TOKEN"), appStoreRelease: false)
```

**Conditionally use the SDK**

Since the **Import** of the Applivery SDK has been excluded from the `.xcconfig` file when building the code, we recommend using **Swift Compiler Custom Flags and Active Compilation Conditions** to declare a set of constants that will help you conditionally start the Applivery SDK. Here is an example:

```swift
#if !APPSTORE
import Applivery
#endif

struct AppliveryWrapper {
   func setup() {
       #if !APPSTORE && !DEBUG
       let applivery = Applivery.shared
       applivery.logLevel = .info
       applivery.start(token:InfoDictionary("APPLIVERY_TOKEN"), appStoreRelease: false)
       #endif
   }
}
```

![ios-sdk-configurations-004 | Applivery](https://docs.applivery.com/int/_r2/media/09ac0a4e-3ad8-478f-9f15-3474973eec71/88f9c11a-9677-4a6c-8986-d5d090a0a574.png)

Alternatively, if you do not want to use Configuration Files, you can exclude certain **Source File Names** under the **Build Settings** of your project for each of your Project Schemes.

:::tip
Remember to thoroughly test your App in all environments to ensure the Applivery SDK is correctly excluded from production Builds.
:::
