# 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.&#x20;

## 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
