---
title: "Integrate the iOS SDK"
slug: "ios-sdk-integration"
updated: 2026-06-09T22:04:47Z
published: 2026-06-09T22:04:47Z
canonical: "docs.xtremepush.com/ios-sdk-integration"
stale: true
---

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

# Integrate the iOS SDK

Use the Xtremepush SDK to integrate your iOS App with the Platform

1. To initialise Xtremepush you must modify your Application Delegate. Inside application `didFinishLaunchingWithOptions` add the following code to import the *XPush* SDK:

**Swift**

```swift
import XPush
```

**Objective-C**

```objectivec
#import <XPush/XPush.h>
```

1. Inside `applicationDidFinishLaunching:withOptions` add the following, replacing `XPUSH_APP_KEY` with the SDK application key provided when [adding the app to the platform](/documentation/docs/ios-integration) :

**Swift**

```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {    
    XPush.setAppKey("XPUSH_APP_KEY")
    #if DEBUG
    // Show Debug logs in debug builds
    XPush.setShouldShowDebugLogs(true)
    #endif
    XPush.applicationDidFinishLaunching(options: launchOptions)    
    return true
}
```

**Objective-C**

```objectivec
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [XPush setAppKey: @"XPUSH_APP_KEY"];
    #if DEBUG
    // Show Debug logs in debug builds
    [XPush setShouldShowDebugLogs:YES]; 
    #endif 
    [XPush applicationDidFinishLaunchingWithOptions:launchOptions];
}
```

1. In case your project is provisioned in US shared cloud, add the following code after `XPush.setAppKey`:

**Swift**

```swift
XPush.setServerURL("https://sdk.us.xtremepush.com")
```

**Objective-C**

```objectivec
[XPush setServerURL: @"https://sdk.us.xtremepush.com"];
```

1. In the event your project is provisioned in the US Region or in a private cloud, alongside setting the Server URL, you will also need to implement Public Key Pinning. To do so:

a. Generate a `.der` file for the client's server URL eg: `sdk.example.xtremepush.com` ([contact us](/documentation/docs/contact-us) so that we can provide this URL).

b. In Terminal run the following command with the appropriate server URL:
  1. ```plaintext
openssl s_client -servername [https://sdk.example.xtremepush.com](https://sdk.example.xtremepush.com) -connect sdk.example.xtremepush.com:443 2>/dev/null | openssl x509 -outform der -out cert.der`
```

c. Drag and drop the `cert.der` file that was created into your Xcode project. Ensure to include it in Copy Bundle Resources in Build Phases also
  2. d. Reference this certificate in didFinishLaunching in the AppDelegate after setting the server url:

**Swift**

```swift
XPush.setServerURL("https://sdk.example.xtremepush.com")
let path = Bundle.main.path(forResource: "cert", ofType: "der")
XPush.setServerExpectedCertificateFromFile(path)
```

**Objective-C**

```objectivec
[XPush setServerURL:@"https://sdk.example.xtremepush.com"];
NSString* path = [[NSBundle mainBundle] pathForResource:@"cert" ofType:@"der"];
[XPush setServerExpectedCertificateFromFile:path];
```

## Add description for CoreBluetooth

Since iOS 10 `NSBluetoothPeripheralUsageDescription` is required to be set if your app includes *CoreBluetooth*, even if it is not actively used. As the Xtremepush SDK includes *CoreBluetooth* you must add the `NSBluetoothPeripheralUsageDescription` key and associated usage description to your `Info.plist` file.

> [!TIP]
> If you're not using the SDK's [Bluetooth features for iBeacons](/documentation/docs/ios-sdk-location), you could just set the description to something simple like "Using Bluetooth".

This usage description is only used when *Acts as a Bluetooth LE accessory* is added to background modes. The Xtremepush SDK does not use this mode, and iBeacon support is only enabled by following the instructions in [iOS location permissions](/documentation/docs/ios-sdk-location). Unless you use *Acts as a Bluetooth LE accessory* elsewhere in your app, this will not be shown to the user.

Failure to include this description key will result in an automated rejection when uploading your app to the App Store and an email notification similar to the one below:

![](https://cdn.document360.io/b056e88b-f6c1-4bd2-b5b8-08e9336a17c9/Images/Documentation/97065eb-ios13_bluetooth_infoplist-3(1).png)

> [!TIP]
> Make sure you set the user ID
> 
> It is recommended that at this stage you use our SDK method to set user IDs by following our [dedicated guide](/documentation/docs/set-user-id) to ensure devices can be associated and targeted in your campaigns by your own unique identifier.
