> For the complete documentation index, see [llms.txt](https://docs.digitalturbine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalturbine.com/dt-exchange/sdk-configuration/integrating-the-ios-sdk/sdk-initialization-for-dt-exchange-sdk.md).

# SDK Initialization for DT Exchange SDK

This guide explains how to configure advanced settings and initialize the DT Exchange SDK in your iOS application to ensure ad delivery and access to all SDK features.

## API init Method <a href="#h_01je0vtp3vhykqmetknnen37wf" id="h_01je0vtp3vhykqmetknnen37wf"></a>

To initialize the SDK, use the `initWithAppID:` method with your `AppID`.

{% code title="Objective-C" %}

```objective-c
 IASDKCore
  - (void)initWithAppID:(NSString * _Nonnull)appID
      completionBlock:(IASDKCoreInitBlock _Nullable)completionBlock
      completionQueue:(dispatch_queue_t _Nullable)completionQueue;
```

{% endcode %}

The following table describes the parameters for the `initWithAppID:` method.

| PARAMETER         | PARAMETER TYPE                                                    | DESCRIPTION                                                                                                                                                          |
| ----------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `initWithAppID`   | <p><code>NSString \*</code><br><code>\_Nonnull</code></p>         | A mandatory parameter that defines the application ID in the DT Console.                                                                                             |
| `completionBlock` | <p><code>IASDKCoreInitBlock</code><br><code>\_Nullable</code></p> | An optional block that executes when SDK initialization is complete. It provides a `BOOL` success flag and an optional `NSError` object if the initialization fails. |
| `completionQueue` | <p><code>dispatch\_queue\_t</code><br><code>\_Nullable</code></p> | An optional queue specifying where the `completionBlock` invokes.                                                                                                    |

### API init Flag <a href="#h_01je0vtp3v4208jpy95n58jdzm" id="h_01je0vtp3v4208jpy95n58jdzm"></a>

You can verify the SDK initialization status using the `initialised` property:

{% code title="Objective-C" %}

```objective-c
  IASDKCore
  @property (atomic, readonly, getter=isInitialised) BOOL initialised;
```

{% endcode %}

This property returns `YES` if the SDK initialization is successful.

### Callback Completion Error Codes <a href="#h_01je0vtp3v4r13mm1zperj723w" id="h_01je0vtp3v4r13mm1zperj723w"></a>

If an error occurs, `NSSError` returns one of the following error codes.

{% code title="Objective-C" %}

```objective-c
    IASDKCore
    typedef NS_ENUM(NSInteger, IASDKCoreInitErrorType) {
    IASDKCoreInitErrorTypeUnknown = 0,
    IASDKCoreInitErrorTypeFailedToDownloadMandatoryData = 1,
    IASDKCoreInitErrorTypeInvalidAppID = 3,
    IASDKCoreInitErrorTypeCancelled = 4
};
```

{% endcode %}

The following table describes the Callback Completion Error Codes.

| ERROR CODE                                            | DESCRIPTION                                           |
| ----------------------------------------------------- | ----------------------------------------------------- |
| `IASDKCoreInitErrorTypeUnknown`                       | An unknown error occurred.                            |
| `IASDKCoreInitErrorTypeFailedToDownloadMandatoryData` | Mandatory data download failed.                       |
| `ASDKCoreInitErrorTypeInvalidAppID`                   | The provided `AppID` is invalid.                      |
| `IASDKCoreInitErrorTypeCancelled`                     | The initialization process was canceled or restarted. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digitalturbine.com/dt-exchange/sdk-configuration/integrating-the-ios-sdk/sdk-initialization-for-dt-exchange-sdk.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
