Getting Started

Requirements

  • Access to a Business Profile
  • Created Client API Key
  • Minimum Environment:
    • Xcode 10
    • iOS SDK 12
  • Target Deployment: iOS 9.0+
  • Valid architectures:
    • armv7, armv7s, arm64 for devices
    • i386, x86_64 for simulators

Frameworks

The Synerise SDK references the following frameworks:

  • NSFoundation.framework
  • UIKit.framework
  • CoreTelephony.framework

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

If you don’t have CocoaPods installed yet and don’t know it, please start with CocoaPods - Getting Started.

  1. Once you have CocoaPods installed you should add dependency to Synerise SDK into your Podfile:

    use_frameworks!
    
    target YOUR_PROJECT_TARGET do
    pod 'SyneriseSDK'
    end
    
  2. After that, you just should execute shell command in directory depending on your project configuration:

    pod repo update
    pod install
    

Carthage

Carthage is simple, decentralized dependency manager for Cocoa projects.

If you don’t have Carthage installed yet and don’t know it, please start with Carthage project on GitHub.

  1. Once you have Carthage installed you should add dependency to Synerise SDK into your Cartfile:

    github "synerise/ios-sdk"
    
  2. After that, you just should execute shell command in directory depending on your project configuration:

    carthage update
    
  3. Go to Xcode project target’s General section.

  4. Open <YOUR_XCODE_PROJECT_DIRECTORY>/Carthage/Build/iOS in Finder and drag SyneriseSDK.framework to Embedded Binaries.

  5. Make sure Copy items if needed is selected and click Finish.


Configuration

Import Synerise SDK

You will need to import Synerise SDK header into the files that contain code relating to SDK.

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

Setup

  1. Go to Xcode project target’s General section, find Other Linker Flags property and add -ObjC flag.

  2. If you are going to use Remote Notifications:

    • Go to your application file (often called Info.plist).
    • Add a row for Required background mode of type Array with App downloads content in response to push notifications.
    • Or add code belkow directly:

      <key>UIBackgroundModes</key>
      <array>
      <string>remote-notification</string>
      </array>
      
  3. If you are going to use HTTP addresses (instead only HTTPS), you will need to change whitelist domains in your app by adding the following to your application file (often called Info.plist):

    <key>NSAppTransportSecurity</key>
    <dict>
    	<key>NSAllowsArbitraryLoads</key><true/>
    </dict>
    

Initialization

First of all, you need to initialize Synerise SDK and provide Client API Key.

You may initialize it wherever you want and when you need.

static NSString *clientApiKey = @"YOUR_CLIENT_API_KEY";

[SNRSynerise initializeWithClientApiKey:clientApiKey]; // 1
[SNRSynerise setDebugModeEnabled:YES]; //2
[SNRSynerise setDelegate:self]; // 3

Let’s dive into some configurable functionalities:

  1. Synerise.initialize(clientApiKey:) - initializes Synerise SDK.
  2. Synerise.setDebugModeEnabled(_:) - enables debug mode for Synerise SDK. See Debug logs section for more information.
  3. Synerise.setDelegate(_:) - sets delegate to handle actions from Synerise SDK. See Synerise SDK Delegate section for more information.

Initialization with custom API environment

There is option to change API baseURL for on-premise installations.

One thing you have to do for that is using different initialization method:

let clientApiKey = "YOUR_CLIENT_API_KEY"
let apiBaseUrl = "YOUR_API_BASE_URL"

Synerise.initialize(clientApiKey: clientApiKey, baseUrl: apiBaseUrl)

Debug logs

It is not recommended to use debug mode in a release version of your app.

You can enable debug logs for Synerise SDK by method Synerise.setDebugModeEnabled(_:). It enables logging for all modules.

Synerise.setDebugModeEnabled(true)

However, it might be enabled or disabled for each module by method <MODULE>.setLoggingEnabled(_:).

Tracker.setLoggingEnabled(true)
  • Tracker: you can receive some simple logs about sending events by enabling debug mode, which is disabled by default.
  • Client: you can receive some simple logs about client actions by enabling debug mode, which is disabled by default.
  • Promotions: you can receive some simple logs about promotions and vouchers actions by enabling debug mode, which is disabled by default.
  • Injector: you can receive some simple logs about Injector actions by enabling debug mode, which is disabled by default.
  • Content: you can receive some simple logs about Content actions by enabling debug mode, which is disabled by default.

Synerise SDK Delegate

You can specify your custom action when a user clicks on simple push, banner or walkthrough. Synerise SDK implements two main actions that user may invoke - open URL and Deeplink.

There is one more method when Synerise SDK needs re-registration for push notifications.

  • snr_registerForPushNotificationsIsNeeded() - This method is called when Synerise needs registration for Push Notifications.
  • snr_handledAction(url:) - This method is called when Synerise handles URL action from campaign activities.
  • snr_handledAction(deepLink:) - This method is called when Synerise handles deeplink action from campaign activities.
  • snr_handledAction(url:activity:completionHandler:) - This method is called when Synerise handles URL action from campaign activities.
  • snr_handledAction(deepLink:activity:completionHandler:) - This method is called when Synerise handles deeplink action from campaign activities.

See Configure Notifications.

For more information about handling actions from Synerise SDK, see Campaigns.

😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.