> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Config-Based Initialization

> Configure the MoEngage iOS SDK from a MoEngage dictionary in your app's Info.plist to initialize the SDK.

## Overview

Config-based initialization keeps your MoEngage configuration in a `MoEngage` dictionary in your app target's `Info.plist`. You generate the dictionary from the MoEngage config generator, and the SDK initializes from it.

## Prerequisites

* MoEngage iOS SDK 10.03.2 or later. See [SDK Integration](https://moengage.com/docs/developer-guide/ios-sdk/sdk-integration/basic/sdk-integration.md).
* Your Workspace ID, from **Settings > Account > General Settings** in the MoEngage dashboard.
* Your data center. See [Data Center](https://moengage.com/docs/developer-guide/ios-sdk/sdk-integration/basic/data-center.md).

## Generate the Configuration

**1. Choose the Platform**

Go to the [MoEngage config generator](https://app-cdn.moengage.com/sdk/integration/initialization/index.html), select **iOS**, then select **Continue**.

**2. Select Your Features**

Select the modules your app needs, then select **Continue**.

**3. Set Your Values**

Enter your values.

**4. Generate the Configuration**

Select **Generate the code**. The generator lists your packages under **Dependencies** and the configuration under **Config File**. Select **Copy**.

Add the package products listed under **Dependencies** through Swift Package Manager or CocoaPods, against the targets the same section names.

## Add the Configuration to Info.plist

**1. Open Info.plist**

Open your app target's `Info.plist`. An app created with Xcode 13 or later often has no `Info.plist` file, because the target generates one at build time. In that case, add the dictionary under **Custom iOS Target Properties** on the target's **Info** tab, and Xcode creates the file.

**2. Add the MoEngage Dictionary**

Add a top-level key named `MoEngage` of type **Dictionary**, and add the generated keys inside it.

> [!WARNING]
>
> Return to the config generator whenever a value changes or you adopt another module, and replace the dictionary with the new output. The SDK matches key names exactly and ignores any key it does not recognize, without a build or run-time warning, so a hand-typed key leaves the default in place and the SDK runs on a configuration you did not intend.

## Test and Live Environments

The TEST environment serves development and testing. The LIVE environment runs campaigns against your production user base. You [switch between the two environments in the dashboard](https://moengage.com/docs/user-guide/getting-started/initial-setup/dashboard-overview.md#live-and-test-environments).

Select the environment in the generator's **MoEngage Environment** field:

| MoEngage Environment | Behavior |
| :- | :- |
| **Default** | Debug builds track to TEST, and release builds track to LIVE. |
| **Test** | Every build tracks to TEST. |
| **Live** | Every build tracks to LIVE. |

> [!WARNING]
>
> Verify the resolved environment before you ship. A mismatch between the build and the environment returns a **Bad Device Token** error on push delivery.

### Set the Build Configuration

When you run the app from Xcode without archiving, confirm that the build configuration for **Run** mode of the app target in **Edit Scheme** is set to **Debug**, which is the default. The SDK then tracks data in the TEST environment.

![Xcode Edit Scheme dialog with Run mode build configuration set to Debug](https://mintcdn.com/moengage/Jtvf10ggM77HdKvB/images/sdkini3.png?fit=max\&auto=format\&n=Jtvf10ggM77HdKvB\&q=85\&s=1c3e28e9ae39412781e5504bc085d6d4)

For the **Archive** section in **Edit Scheme**, the build configuration defaults to **Release**. For a development build, go to **App Target > Edit Scheme > Archive > Build Configuration** and select **Debug** before you export.

![Xcode Edit Scheme dialog with Archive build configuration selection](https://mintcdn.com/moengage/Jtvf10ggM77HdKvB/images/sdkini4.png?fit=max\&auto=format\&n=Jtvf10ggM77HdKvB\&q=85\&s=d1de3e92696d22d81733ab587d3f9fd3)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.