# Installation and configuration (iOS)

In this article, you will find out how to install and initialize the Synerise SDK in an iOS application. While performing the actions from this guide, keep the presented order. 


<div class="admonition admonition-important"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

The [Settings](/developers/mobile-sdk/settings#pre-initialization-settings) article contains additional information about SDK behaviors you may need prior to configuration.

</div></div></div>
 

If you want to find out what kind of benefits you can get from integrating with mobile SDK, go [here](/developers/mobile-sdk/overview).

## Requirements
---
You need:
* Access to a [workspace](/docs/settings/business-profile)
* A Profile [API Key](/docs/settings/tool/api#adding-api-keys)  
    When creating the API key, use allowlisting or denylisting to only allow the events you intend to use.
* One of the following dependency managers:
    - [CocoaPods](https://guides.cocoapods.org/using/getting-started.html) - CocoaPods is a dependency manager for iOS projects.
    - [Carthage](https://github.com/Carthage/Carthage) - Carthage is a simple, decentralized dependency manager for iOS projects. 
    - [Swift Package Manager](https://www.swift.org/package-manager/) - Swift Package Manager (SPM) is a dependency manager built into Xcode.
* Recommended environment:
    - Xcode 16
    - iOS SDK 18
* Target deployment:
    - **iOS 13.0+** for SDK versions 5.0.0 and higher
    - **iOS 9.0+** for SDK versions lower than 5.0.0


   <div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

   Bitcode is not supported in SDK version 5.0.0 and higher. Xcode ignores bitcode.

   </div></div></div>
 

### Apple Frameworks

The Synerise SDK references the following Apple frameworks:

- `Foundation.framework`
- `UIKit.framework`
- `CoreGraphics.framework`
- `SystemConfiguration.framework`
- `MobileCoreServices.framework`
- `CoreTelephony.framework`
- `Security.framework`
- `CommonCrypto.framework`
- `WebKit.framework`
- `UserNotifications.framework`

### 3rd Party Frameworks

- [AFNetworking (fork)](https://github.com/AFNetworking/AFNetworking)
- [TrustKit](https://github.com/datatheorem/TrustKit)
- [Aspects](https://github.com/steipete/Aspects)


## Installation
---

### CocoaPods

1. Add CocoaPods dependency to **Synerise SDK** into your `Podfile`:
    
   <pre><code class="language-ruby">use_frameworks!

       target YOUR_PROJECT_TARGET do
         pod 'SyneriseSDK'
       end</code></pre>

2. Execute the following shell command in the directory depending on your project configuration:
    
   <pre><code class="language-plaintext">pod repo update  
       pod install</code></pre>


### Swift Package Manager (SPM)

1. Go to Xcode project’s settings and navigate to the Package Dependencies tab.
2. Below the packages list, click the Add button.
3. Enter the URL of Synerise SDK repository **(https://github.com/Synerise/synerise-ios-sdk)** in the search text field.
4. Under the Dependency Rule section, select the SDK version. Finally, click **Add Package**.
5. Select the package that best suits your needs and click **Add Package**.

### Carthage

1. Add the Carthage dependency to **Synerise SDK** into your `Cartfile`:

    
   <pre><code class="language-plaintext">github "synerise/ios-sdk"</code></pre>


2. Execute the shell command in directory depending on your project configuration:

    
   <pre><code class="language-plaintext">carthage update</code></pre>


3. Go to Xcode project target's **General** section.
4. In Finder, open `<YOUR_XCODE_PROJECT_DIRECTORY>/Carthage/Build/iOS`
5. Drag `SyneriseSDK.framework` to **Embedded Binaries**.
6. Make sure the **Copy items if needed** option is selected.
7. Click **Finish**.

## Initialization
---

### Setting up

1. Go to Xcode project target's **General** section.
2. Find the **Other Linker Flags** property and add the ***-ObjC*** flag.

2. If you are going to use push notifications:
    1. Go to `Info.plist`
    2. Add a row for **Required background mode** with the following array type value: `App downloads content in response to push notifications` or add the code below directly:
    
       <pre><code class="language-xml">&lt;key&gt;UIBackgroundModes&lt;/key&gt;
           &lt;array&gt;
               &lt;string&gt;remote-notification&lt;/string&gt;
           &lt;/array&gt;</code></pre>


3. If you are going to use HTTP addresses (instead of only HTTPS), change the allowlist domains in your app by adding configuration to `Info.plist` in one of the following ways:
    - Add configured domain/domains that you need.
    
      <pre><code class="language-xml">&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
          &lt;dict&gt;
              &lt;key&gt;NSExceptionDomains&lt;/key&gt;
              &lt;dict&gt;
                  &lt;key&gt;yourdomain.com&lt;/key&gt;
                  &lt;dict&gt;
                  &lt;!--Include to allow subdomains--&gt;
                  &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
                  &lt;true/&gt;
                  &lt;!--Include to allow HTTP requests--&gt;
                  &lt;key&gt;NSTemporaryExceptionAllowsInsecureHTTPLoads&lt;/key&gt;
                  &lt;true/&gt;
                  &lt;!--Include to specify minimum TLS version--&gt;
                  &lt;key&gt;NSTemporaryExceptionMinimumTLSVersion&lt;/key&gt;
                  &lt;string&gt;TLSv1.1&lt;/string&gt;
                  &lt;/dict&gt;
              &lt;/dict&gt;
          &lt;/dict&gt;</code></pre>

    - Give permission for all domains.
    
      <pre><code class="language-xml">&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
          &lt;dict&gt;
              &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;&lt;true/&gt;
          &lt;/dict&gt;</code></pre>


### Importing Synerise SDK

Import the **Synerise SDK** header into the files that contain code relating to SDK. 


<div class="content-tabs code-tabs" data-tab-group="tabgrp-609">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-609-0" data-tab-group="tabgrp-609" data-tab-active="true">Swift</button><button class="tab-button" data-tab-id="tabgrp-609-1" data-tab-group="tabgrp-609">Objective-C</button></div>

<div class="tab-panel" data-tab-id="tabgrp-609-0" data-tab-group="tabgrp-609" data-tab-active="true">

```Swift
import SyneriseSDK
```

</div>

<div class="tab-panel" data-tab-id="tabgrp-609-1" data-tab-group="tabgrp-609">

```Objective-C
#import <SyneriseSDK/SyneriseSDK.h>
```

</div>
</div>



<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

In Objective-C, you can include it in your Prefix Header (PCH) and Synerise SDK will be imported to all files automatically.

</div></div></div>


### Basic initialization

Initialize Synerise SDK and provide the [Profile API Key](/docs/settings/tool/api).  
  
You may initialize it wherever you want and when you need.  


<div class="content-tabs code-tabs" data-tab-group="tabgrp-610">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-610-0" data-tab-group="tabgrp-610" data-tab-active="true">Swift</button><button class="tab-button" data-tab-id="tabgrp-610-1" data-tab-group="tabgrp-610">Objective-C</button></div>

<div class="tab-panel" data-tab-id="tabgrp-610-0" data-tab-group="tabgrp-610" data-tab-active="true">

```Swift
Synerise.initialize(apiKey: "YOUR_PROFILE_API_KEY") // 1
Synerise.setDebugModeEnabled(false) // 2
Synerise.setCrashHandlingEnabled(true) // 3
Synerise.setDelegate(self) // 4
```

</div>

<div class="tab-panel" data-tab-id="tabgrp-610-1" data-tab-group="tabgrp-610">

```Objective-C
[SNRSynerise initializeWithApiKey:@"YOUR_PROFILE_API_KEY"]; // 1
[SNRSynerise setDebugModeEnabled:NO]; // 2
[SNRSynerise setCrashHandlingEnabled:YES]; // 3
[SNRSynerise setDelegate:self]; // 4
```

</div>
</div>


Basic methods you need:
1. [`Synerise.initialize(apiKey:)`](/developers/mobile-sdk/method-reference/ios/lifecycle#initialization) - Initializes Synerise SDK.
2. [`Synerise.setDebugModeEnabled(_:)`](/developers/mobile-sdk/method-reference/ios/lifecycle#enable-debug-mode) - Enables debug mode for Synerise SDK. See [Debug mode](/developers/mobile-sdk/installation-and-configuration/ios#debug-mode) section for more information.
3. [`Synerise.setCrashHandlingEnabled(_:)`](/developers/mobile-sdk/method-reference/ios/lifecycle#enable-crash-handling) - Enables crash handling. Synerise SDK sends a crash event automatically when an uncaught exception occurs.
4. [`Synerise.setDelegate(_:)`](/developers/mobile-sdk/method-reference/ios/lifecycle#set-synerise-delegate)- Sets delegate to handle main actions from Synerise SDK. See [`SyneriseDelegate`](/developers/mobile-sdk/listeners-and-delegates/ios-delegates#synerise-delegate) section for more information.

### Initialization with custom API environment

To change API base URL for on-premise installations, use the following initialization method:


<div class="content-tabs code-tabs" data-tab-group="tabgrp-611">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-611-0" data-tab-group="tabgrp-611" data-tab-active="true">Swift</button><button class="tab-button" data-tab-id="tabgrp-611-1" data-tab-group="tabgrp-611">Objective-C</button></div>

<div class="tab-panel" data-tab-id="tabgrp-611-0" data-tab-group="tabgrp-611" data-tab-active="true">

```Swift
Synerise.initialize(apiKey: "YOUR_PROFILE_API_KEY", baseUrl: "YOUR_API_BASE_URL")
```

</div>

<div class="tab-panel" data-tab-id="tabgrp-611-1" data-tab-group="tabgrp-611">

```Objective-C
[SNRSynerise initializeWithClientApiKey:@"YOUR_PROFILE_API_KEY" andBaseUrl:@"YOUR_API_BASE_URL"];
```

</div>
</div>



### Advanced initialization

This is an example of advanced initialization with:
- custom API base URL for on-premise installations
- request validation salt configured
- debug mode enabled
- crash handling enabled
- most of the settings options available
- main delegate [`SyneriseDelegate`](/developers/mobile-sdk/listeners-and-delegates/ios-delegates#synerise-delegate)
- client's state delegate [`ClientStateDelegate`](/developers/mobile-sdk/listeners-and-delegates/ios-delegates#client-state-delegate)


  <div class="admonition admonition-important"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

  We highly recommend to configure settings when Synerise SDK is initialized, before invoking the [`Synerise.initialize(apiKey:)`](/developers/mobile-sdk/method-reference/ios/lifecycle#initialization) method. See [Settings](/developers/mobile-sdk/settings) section for more details about settings options.

  </div></div></div>



<div class="admonition admonition-important"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

Secure sensitive keys (for example, `apiKey` and `requestValidationSalt`) with mechanisms like string obfuscation or encryption.

</div></div></div>



<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

You can find more information about all [Synerise iOS SDK delegates here](/developers/mobile-sdk/listeners-and-delegates/ios-delegates).

</div></div></div>



<div class="content-tabs code-tabs" data-tab-group="tabgrp-612">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-612-0" data-tab-group="tabgrp-612" data-tab-active="true">Swift</button><button class="tab-button" data-tab-id="tabgrp-612-1" data-tab-group="tabgrp-612">Objective-C</button></div>

<div class="tab-panel" data-tab-id="tabgrp-612-0" data-tab-group="tabgrp-612" data-tab-active="true">

```Swift
Synerise.settings.sdk.enabled = true
Synerise.settings.sdk.appGroupIdentifier = "YOUR_APP_GROUP_IDENTIFIER"
Synerise.settings.sdk.keychainGroupIdentifier = "YOUR_KEYCHAIN_GROUP_IDENTIFIER"
Synerise.settings.sdk.minTokenRefreshInterval = 1800
Synerise.settings.sdk.shouldDestroySessionOnApiKeyChange = false

Synerise.settings.notifications.enabled = true
Synerise.settings.notifications.disableInAppAlerts = true
Synerise.settings.notifications.encryption = false

Synerise.settings.tracker.autotracking.enabled = true
Synerise.settings.tracker.autotracking.mode = AutoTrackMode.Fine
Synerise.settings.tracker.autotracking.excludedClasses = [SampleViewController.self]
Synerise.settings.tracker.autotracking.excludedViewTags = [0, 1, 2]

Synerise.settings.tracker.tracking.enabled = true

Synerise.settings.tracker.minBatchSize = 10
Synerise.settings.tracker.maxBatchSize = 100
Synerise.settings.tracker.autoFlushTimeout = 5.0
Synerise.settings.tracker.autoTracking.mode = .fine
Synerise.settings.tracker.locationAutomatic = true

Synerise.settings.injector.automatic = true

Synerise.initialize(apiKey: "YOUR_PROFILE_API_KEY", baseUrl: "YOUR_API_BASE_URL")
Synerise.setRequestValidationSalt("YOUR_REQUEST_VALIDATION_SALT")
Synerise.setDebugModeEnabled(false)
Synerise.setCrashHandlingEnabled(true)
Synerise.setDelegate(self)

Client.setClientStateDelegate(self)
```

</div>

<div class="tab-panel" data-tab-id="tabgrp-612-1" data-tab-group="tabgrp-612">

```Objective-C
SNRSynerise.settings.sdk.enabled = @YES;
SNRSynerise.settings.sdk.appGroupIdentifier = @"YOUR_APP_GROUP_IDENTIFIER";
SNRSynerise.settings.sdk.keychainGroupIdentifier = @"YOUR_KEYCHAIN_GROUP_IDENTIFIER";
SNRSynerise.settings.sdk.minTokenRefreshInterval = 1800;
SNRSynerise.settings.sdk.shouldDestroySessionOnApiKeyChange = NO;

SNRSynerise.settings.notifications.enabled = YES;
SNRSynerise.settings.notifications.disableInAppAlerts = YES;
SNRSynerise.settings.notifications.encryption = NO;

SNRSynerise.settings.tracker.autotracking.enabled = YES;
SNRSynerise.settings.tracker.autotracking.mode = SNRTrackerAutoTrackModeFine;
SNRSynerise.settings.tracker.autotracking.excludedClasses = [SampleViewController.class];
SNRSynerise.settings.tracker.autotracking.excludedViewTags = [@0, @2, @3];

SNRSynerise.settings.tracker.tracking.enabled = YES;

SNRSynerise.settings.tracker.minBatchSize = 10;
SNRSynerise.settings.tracker.maxBatchSize = 100;
SNRSynerise.settings.tracker.autoFlushTimeout = 5.0;
SNRSynerise.settings.tracker.autoTracking.mode = SNRTrackerAutoTrackModeFine;
SNRSynerise.settings.tracker.locationAutomatic = YES;

SNRSynerise.settings.injector.automatic = YES;

[SNRSynerise initializeWithApiKey:@"YOUR_PROFILE_API_KEY" andBaseUrl:@"YOUR_API_BASE_URL"];
[SNRSynerise setRequestValidationSalt:@"YOUR_REQUEST_VALIDATION_SALT"];
[SNRSynerise setDebugModeEnabled:NO];
[SNRSynerise setCrashHandlingEnabled:YES];
[SNRSynerise setDelegate:self];

[SNRClient setClientStateDelegate:self];
```

</div>
</div>


### Initialization process

During initialization, the library starts and when it is ready or an error occurs, the SDK notifies you.

When the delegate method is called, Synerise is ready to use.


<div class="content-tabs code-tabs" data-tab-group="tabgrp-613">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-613-0" data-tab-group="tabgrp-613" data-tab-active="true">Swift</button><button class="tab-button" data-tab-id="tabgrp-613-1" data-tab-group="tabgrp-613">Objective-C</button></div>

<div class="tab-panel" data-tab-id="tabgrp-613-0" data-tab-group="tabgrp-613" data-tab-active="true">

```Swift
// MARK: - SyneriseDelegate

// This method is called when the Synerise SDK is initialized.
func snr_initialized() {
  //...
}

// This method is called when an error occurs while initializing the Synerise SDK.
func snr_initializationError(error: Error) {
  //...
}
```

</div>

<div class="tab-panel" data-tab-id="tabgrp-613-1" data-tab-group="tabgrp-613">

```Objective-C
#pragma mark - SNRSyneriseDelegate

// This method is called when the Synerise SDK is initialized.
- (void)SNR_initialized {
  //...
}

// This method is called when an error occurs while initializing the Synerise SDK.
- (void)SNR_initializationError:(NSError *)error {
  //...
}
```

</div>
</div>



## Debug Mode
---
You can enable debug logs for Synerise SDK by method [`Synerise.setDebugModeEnabled(_:)`](/developers/mobile-sdk/method-reference/ios/lifecycle#enable-debug-mode).


<div class="admonition admonition-warning"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z" /></svg></div><div class="admonition-body"><div class="admonition-content">

Do not use Debug Mode in a release version of your application.

</div></div></div>



<div class="content-tabs code-tabs" data-tab-group="tabgrp-614">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-614-0" data-tab-group="tabgrp-614" data-tab-active="true">Swift</button><button class="tab-button" data-tab-id="tabgrp-614-1" data-tab-group="tabgrp-614">Objective-C</button></div>

<div class="tab-panel" data-tab-id="tabgrp-614-0" data-tab-group="tabgrp-614" data-tab-active="true">

```Swift
Synerise.setDebugModeEnabled(true) // Enables logging for all modules
```

</div>

<div class="tab-panel" data-tab-id="tabgrp-614-1" data-tab-group="tabgrp-614">

```Objective-C
[SNRSynerise setDebugModeEnabled:YES]; // Enables logging for all modules
```

</div>
</div>


You can receive some logs about:
- **Core**: push notifications
- **Tracker**: auto-tracked events, declarative events, sending process
- **Client**: customer state, authorization
- **Injector**: campaigns, UI
- **Promotions**: promotions, vouchers
- **Content**: content widget, documents, recommendations

## Background Tasks
---
[Background Tasks](https://developer.apple.com/documentation/backgroundtasks) is a mechanism to schedule and run code in the background to keep your app up to date. 

Synerise supports using Background Tasks since SDK version **4.23.0**. You can pass configured identifiers for Synerise SDK by using the  [`Synerise.setBackgroundTaskIdentifiers(_:)`](/developers/mobile-sdk/method-reference/ios/lifecycle#set-background-task-identifiers) method. The identifiers that you are going to pass have to be configured properly in the host app.
  
#### Benefits

Currently, the SDK uses Background Tasks only to refresh the registration token for Push Notifications every 20 days. In these situations, the SDK invokes the [snr_registerForPushNotificationsIsNeeded(origin:)](/developers/mobile-sdk/listeners-and-delegates/ios-delegates#synerise-delegate-register-for-push-notifications-is-needed-by-origin) method or [snr_registerForPushNotificationsIsNeeded()](/developers/mobile-sdk/listeners-and-delegates/ios-delegates#synerise-delegate-register-for-push-notifications-is-needed) method.
  
#### Setting up

To configure Background Tasks in your app:
1. Go to Xcode project's target's **Signing & Capabilities** section.
2. In the **Background Modes** capability (you may need to add it), enable **Background fetch** and **Background processing**.
3. Go to `Info.plist`.
4. Add a row with the following array type value: `Permitted background task scheduler identifiers`.
5. Add string identifiers, each as a separate item to declare possible Background Tasks identifiers in your app.
6. Pass these Background Tasks identifiers to SDK by using the [`Synerise.setBackgroundTaskIdentifiers(_:)`](/developers/mobile-sdk/method-reference/ios/lifecycle#set-background-task-identifiers) method. You must invoke the method **BEFORE** your app is launched (before the `application(_ application:didFinishLaunchingWithOptions launchOptions:)` method finishes).

Sample `\*.plist` configuration for Background Tasks:
<figure>
  <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/developers/mobile-sdk/_gfx/ios-background-tasks-plist-configuration.png" alt="Sample *.plist configuration for Background Tasks" class="full">
  <figcaption>Sample *.plist configuration for Background Tasks</figcaption>
</figure>

Example code for passing Background Tasks identifiers to the SDK:  

<div class="content-tabs code-tabs" data-tab-group="tabgrp-615">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-615-0" data-tab-group="tabgrp-615" data-tab-active="true">Swift</button><button class="tab-button" data-tab-id="tabgrp-615-1" data-tab-group="tabgrp-615">Objective-C</button></div>

<div class="tab-panel" data-tab-id="tabgrp-615-0" data-tab-group="tabgrp-615" data-tab-active="true">

```Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // ...
    Synerise.setBackgroundTaskIdentifiers(["YOUR_BACKGROUND_TASK_IDENTIFIER"])

    return true
}
```

</div>

<div class="tab-panel" data-tab-id="tabgrp-615-1" data-tab-group="tabgrp-615">

```Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // ...
    [SNRSynerise setBackgroundTaskIdentifiers:@[@"YOUR_BACKGROUND_TASK_IDENTIFIER"]];

    return YES;
}
```

</div>
</div>



<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

The method's parameter is an array because of possible future purposes.

</div></div></div>



<div class="admonition admonition-important"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

Do not use those identifiers for other Background Tasks in your app.

</div></div></div>


Documentation is available at [Apple Developer - Using background tasks to update your app](https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/using_background_tasks_to_update_your_app).

**IMPORTANT: To configure Background Tasks properly, you must set `SyneriseDelegate` before the SDK initialization.**

<div class="content-tabs code-tabs" data-tab-group="tabgrp-616">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-616-0" data-tab-group="tabgrp-616" data-tab-active="true">Swift</button><button class="tab-button" data-tab-id="tabgrp-616-1" data-tab-group="tabgrp-616">Objective-C</button></div>

<div class="tab-panel" data-tab-id="tabgrp-616-0" data-tab-group="tabgrp-616" data-tab-active="true">

```Swift
Synerise.setDelegate(self)
Synerise.initialize(apiKey: "YOUR_PROFILE_API_KEY")
// ...
```

</div>

<div class="tab-panel" data-tab-id="tabgrp-616-1" data-tab-group="tabgrp-616">

```Objective-C
[SNRSynerise setDelegate:self];
[SNRSynerise initializeWithApiKey:@"YOUR_PROFILE_API_KEY"];
// ...
```

</div>
</div>


## Privacy manifest
---
From **1 May 2024**, Apple requires you to add a privacy manifest. It's a file in your project that describes your reason and method for collecting data.

Third-party frameworks that track data should have a privacy manifest. When you create the application privacy report, these privacy manifest files are automatically aggregated into a single file. 

Synerise supports privacy manifests since SDK version **4.17.0**. When you use an SDK version older than **4.17.0**, refer to the Synerise API usage requirements defined below when creating an Apple privacy manifest.

#### APIs usage

| API | Reason | Description |
| --- | --- | --- |
| User defaults APIs | **CA92.1**<br/>**1C8F.1** | Synerise uses User Defaults to persist the SDK data and share them between the application and extensions |

#### Tracking

Synerise does not track any data that is protected by the [App Tracking Transparency](https://developer.apple.com/documentation/apptrackingtransparency) framework.

#### Collected Data

| Data type | Value | Purpose |
| --- | --- | --- |
| User ID | **NSPrivacyCollectedDataTypeUserID** | Analytics, Product Personalization |
| Other usage data | **NSPrivacyCollectedDataTypeOtherUsageData** | Analytics, Product Personalization, App Functionality |
| Product interaction | **NSPrivacyCollectedDataTypeProductInteraction** | Analytics |
| Advertising data | **NSPrivacyCollectedDataTypeAdvertisingData** | Other Purposes, App Functionality |
| Crash data | **NSPrivacyCollectedDataTypeOtherUserContent** | Analytics |


## Warnings and limitations
---

Be careful with keychain deletion operations due to the possibility of deleting Synerise data. All the SDK library data keys are named `snr.[KEY_NAME]`.


