Help Center

BlueConic SDK for iOS

How apple developers can use the BlueConic SDK for iOS to create custom mobile apps for their CDP use casesThe BlueConic SDK for iOS makes it easy for developers to collect profile data from their apps. This section explains how to integrate BlueConic into your iOS apps. If you are looking for information on Android apps, see the BlueConic SDK for Android.

 

You can use the BlueConic iOS SDK to do the following:

  • Set and retrieve profile property values
  • Serve (custom) dialogues 
  • Track user behavior using listeners

BlueConicClient Framework

The BlueConicClient Framework provides the basis for communication with BlueConic. It provides possibilities to develop your own interactions by creating mobile plugins. There is a tutorial on how to create an iOS Plugin, see Tutorial: Mobile plugin for iOS. In addition to creating your own plugins, BlueConicClient Framework allows you to make use of the standard BlueConic plugins. It contains several plugins that are mobile variants of the standard BlueConic plugins, such as Listeners and Dialogues.  


Before you begin

Before you start implementing the BlueConic SDK for iOS, make sure you have the following:

The binary distribution files of the SDK have been built for iOS 12.

Note: As of the most recent version of the SDK, the use of the BlueConic Simulator is restricted to Debug mode only.

To test your mobile app you will want to have access to a BlueConic environment. There are two options:

  • Are you working on behalf of a BlueConic Customer that has a BlueConic environment set up? Then ask a representative of the BlueConic Customer to request a Sandbox environment in which you can test your mobile app.
  • Alternatively, request a free Pyxis environment for yourself, and test your mobile app with that.

Updates to iOS Mobile SDK for Apple iOS 14

At the yearly Apple developers’ conference, Apple announced new data privacy and security changes to IDFA (identifier for advertisers) for iOS 14 that affect all iOS mobile SDK developers. Updates to Apple’s privacy policies will require mobile SDK apps to notify and request permission to track in order to collect the user’s Mobile Ad ID beginning in 2021. Our developers are monitoring Apple’s privacy policies and creating a new BlueConic iOS SDK, which will no longer be able to autodetect and collect the Mobile Ad ID via the BlueConic Global Listener.

If you want to release a new version of your app to the app store, you will need to integrate this new SDK and meet Apple’s privacy requirements. If you choose to collect these data points, you will need to request user permissions, and can use our new method “setMobileAdId”. Contact your BlueConic Customer Success Manager for more information on these changes.

Disclosing the data BlueConic automatically collects

Starting with the release of iOS 14.5, developers using the BlueConic SDK for iOS need to disclose to their customers what data they are collecting. Apple publishes a list of data types that require disclosure. This table describes how BlueConic collects data types that require disclosure:

Location data as defined by Apple BlueConic data collection
Coarse Location Information that describes the location of a user or device with lower resolution than a latitude and longitude with three or more decimal places, such as Approximate Location Services. BlueConic collects this data. A low-resolution location is determined from the IP address of the user.

Identifiers as defined by Apple

User ID Data such as screen name, handle, account ID, assigned user ID, customer number, or other user- or account-level ID that can be used to identify a particular user or account. BlueConic collects this data. Users of the app will get a BlueConic ID.
Usage data as defined by Apple
Product Interaction Data such as app launches, taps, clicks, scrolling information, music listening data, video views, saved place in a game, video, or song, or other information about how the user interacts with the app. BlueConic collects data in relation to visits (app launches) such as visits, last visited date, page views profile properties.
Other data as defined by Apple
Other data types Any other data types not mentioned.

BlueConic collects system information, including:

  • Operating system name
  • Operating system version
  • Screen resolution
  • App vendor
  • Mobile model

 


Getting Started

Before you start implementing the SDK, use the following steps to set up your environment:

  1. Add the BlueConicClient framework to your app:
    There are three ways to do this:
    • Install with CocoaPods
      Add pod 'BlueConicClient' to your Podfile.
    • Install with Swift Package Manager
      In Xcode, go to File->Add Package Dependencies..., then search for https://github.com/blueconic/blueconic-ios-sdk in the top right search bar. Select the bluconic-ios-sdk entry, make sure to select the project you want to add it to and the latest version, and then press Add Package. Once the SDK is downloaded, click again to Add Package.
    • Add the BlueConicClient framework
      In Xcode add the BlueConicClient.xcframework for iOS by dragging the BlueConicClient.xcframework folder into the "Embedded Binaries" section on the General tab.
  2. Add the configuration key for BlueConic:
    Locate your app's Information Property List file under "Supporting Files".
    Select <project>-Info.plist and add a new row by right clicking the top row and selecting "Add row". Set the following key name:
    bc_server_url
    Double-click the value field and enter the URL for the hostname of your BlueConic server. For example:
    https://example.blueconic.net
  3. Add an URL Scheme key for BlueConic simulator:
    Locate your app's Information Property List file under "Supporting Files".
    Select <project>-Info.plist and add a new row by right clicking the top row and selecting "Add row". Set the following key name:
    URL types
    This creates an array which contains more property rows. Open "URL types" by clicking the triangle icon in front of the name to display the rows. Right click "Item 0" and select "Add row". You can also add a new item, and add the new row within that item. Set the following key name:
    URL Schemes
    This creates another array. Add a new row to this array's "Item 0" and enter your apps "Bundle Identifier", for example:
    com.blueconic.testApp
    Full example of the URL Schemes:

    URL types

  4. Optionally, add a debug key for BlueConic:
    Locate your app's Information Property List file under "Supporting Files".
    Select <project>-Info.plist and add a new row by right clicking the top row and selecting "Add row". Set the following key name:
    bc_debug
    Click the type and select 'Boolean'. Set the value to "YES" if you want to receive debug logs from the BlueConic SDK. Adding a debug key is optional; if you do not want to receive debug logs from the SDK, you do not need to add it.
    Setting Debug to true will provide more logging and enable the use of the BlueConic Simulator.
    Warning: When you publish your apps, Debug should always be set False.
  5. Import BlueConic:
    The BlueConic SDK for iOS enables you to set and retrieve profile property values for a BlueConic profile and enables interactions specific to this BlueConic profile. These methods can be used anywhere in the app. Make sure that you import the framework and get the instance before using the BlueConicClient methods:
    // Swift:
    import BlueConicClient
    
    let client = BlueConic.getInstance(self)
    
    // Objective C:
    #import <BlueConicClient/BlueConic-swift.h>
    
    BlueConic *client = [BlueConic getInstance:self]; 
    ** Note: Make sure that you provide the current ViewController as argument when invoking getInstance. If no ViewController is available, pass an empty ViewControl.

  6. After you have added the URL Scheme value, select the AppDelegate class and add the following method to enable simulator functionality:

    // Swift: in the AppDelegate.swift file
    func application(_ application: UIApplication, open url: URL, options: 
    [
    UIApplication.OpenURLOptionsKey: Any] ) -> Bool {
    BlueConic.getInstance(nil).setURL(url) return true } // Objective-C: in the AppDelegate.m file - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
    options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { [[BlueConic getInstance:nil] setURL:url]; return YES; }

For more information, be sure to check out the following:

 


Using the BlueConic iOS SDK

  1. Create a page view event each time the user switches screens. 
    Retrieve an instance of the BlueConic in the "viewDidAppear(animated: Bool)" of every ViewController and create a page view event. Make sure that a unique screen name is passed in the call. The screen name is shown in the BlueConic Simulator, and it can be used in listener rules or to restrict dialogue interactions to specific screens.

    Make sure that you provide the current ViewController as argument when invoking "getInstance" on the BlueConic. If no ViewController is available, pass an empty ViewController.
    // Swift: in the ExampleViewController.swift file
    import UIKit
    import BlueConicClient
    
    class ExampleViewController: UIViewController {
      private var _blueConic: BlueConic?
        
      override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        // Get the BlueConic instance.
        self._blueConic = BlueConic.getInstance(self)
    
        // Set screen name to identify the ViewController
        self._blueConic?.createEvent("PAGEVIEW", 
    properties: ["screenName": "Main/ExampleViewController"]) } }
    // Objective-C: in the ExampleViewController.h file
    #import <UIKit/UIKit.h>
    #import <BlueConicClient/BlueConic-Swift.h>
    
    @interface ExampleViewController : UIViewController
    @end
    
    // Objective-C: in the ExampleViewController.m file
    #import "ExampleViewController.h"
    
    @interface ExampleViewController ()
    
    @property BlueConic* client;
    
    @end
    
    @implementation ExampleViewController
    
    - (void)viewDidAppear:(BOOL)animated {
      [super viewDidAppear:animated];
      // Get the BlueConic instance
      self.client = [BlueConic getInstance:self];
    
      // Set screen name to identify the ViewController
      [self.client createEvent:@"PAGEVIEW" properties:@{@"screenName": 
    @"MAIN/ExampleViewController"}]; } @end
  2. Retrieve and store profile properties:
    The BlueConic SDK for iOS enables you to set and retrieve profile property values for a BlueConic profile. These methods can be used anywhere in the app. The following example counts the number of times a specific activity is opened and stores this number in the BlueConic profile:
    // Swift: in the ExampleViewController.swift file
    import UIKit
    import BlueConicClient
    
    class ExampleViewController: UIViewController {
      private var _blueConic: BlueConic?
      private let PROPERTY_ID = "views";
        
      override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        // Get the BlueConic instance.
        self._blueConic = BlueConic.getInstance(self)
    
        // Get the current value from the profile. 
    This value is returned as a String. let profileValue: String? = self._blueConic?.getProfileValue(self.PROPERTY_ID) var newValue = 1 if (profileValue != nil && Int(profileValue!) != nil) { newValue = Int(profileValue!)! + 1 } // Set the new value in the profile self._blueConic?.setProfileValue(self.PROPERTY_ID, value:String(newValue)) } }
    // Objective-C: in the ExampleViewController.h file
    #import <UIKit/UIKit.h>
    #import <BlueConicClient/BlueConic-Swift.h>
    
    @interface ExampleViewController : UIViewController
    @end
    
    // Objective-C: in the ExampleViewController.m file
    #import "ExampleViewController.h"
    
    @interface ExampleViewController ()
    
    @property BlueConic* client;
    
    @end
    
    @implementation ExampleViewController
    
    static NSString *PROPERTY_ID = @"views";
    
    - (void)viewDidAppear:(BOOL)animated {
      [super viewDidAppear:animated];
      // Get the BlueConic instance
      self.client = [BlueConic getInstance:self];
    
      // Get the current value from the profile. This value is returned as a String.
      NSString* profileValue = [self.client getProfileValue:PROPERTY_ID];
    
      int newValue = [profileValue intValue] + 1;
    
    // Set the new value in the profile
    [self.client setProfileValue:PROPERTY_ID value:[NSString stringWithFormat:@"%d", newValue]]; } @end
  3. Register events:
    Calls to register an event can be done in the onLoad of a custom developed mobile Plugin. The code fragment shows how to trigger a click event. Possible events are: "CLICK", "VIEW" and "CONVERSION"
    // Swift: in the ExamplePlugin.swift file
    import Foundation
    import BlueConicClient
    
    public class TestPlugin: BlueConicPlugin {
      private var _client: BlueConic?
      private var _context: InteractionContext?
        
      override init() {
        super.init()
      }
        
      public required convenience init(client: BlueConic, context: InteractionContext) {
        self.init()
        self._client = client
        self._context = context
      }
        
      public func buttonClicked() {
        self._client?.createEvent("CLICK", properties: ["interactionId": 
    self._context?.getInteractionId()]) } public func onLoad() { let component: UIView? = self._context?.getView() if let button = position as UIButton { button.addTarget(self, action: Selector("buttonClicked"),
    forControlEvents: UIControlEvents.TouchUpInside) } } }
    // Objective-C: in the ExamplePlugin.h file
    
    #import <Foundation/Foundation.h>
    #import <BlueConicClient/BlueConic-Swift.h>
    
    @interface ExamplePlugin: NSObject <BlueConicPlugin>
    
    - (instancetype) initWithClient: (BlueConic *)client 
    context:(InteractionContext *)context; - (void) onLoad; - (void) onDestroy; @end // Objective-C: in the ExamplePlugin.m file #import "ExamplePlugin.h" @interface ExamplePlugin () @property BlueConic* client; @property InteractionContext* context; @end @implementation ExamplePlugin - (instancetype) initWithClient: (BlueConic *)client
    context:(InteractionContext *)context { self = [super init]; if (self) { self.client = client; self.context = context; } return self; } - (void) buttonClicked { [self.client createEvent:@"CLICK" properties:@{@"interactionId":
    [self.context getInteractionId]}]; } - (void) onLoad { UIView* component = [self.context getView]; if ([component isKindOfClass:[UIButton class]]) { UIButton* button = (UIButton*)component; [button addTarget:self action:@selector(buttonClicked)
    forControlEvents:UIControlEventTouchUpInside]; } } @end

Configuring BlueConic

This section describes how to add the channel for your mobile application to your BlueConic domains as well as how to define your custom profile properties so that you can use them in BlueConic segments.

Add the mobile channel

Before you can start measuring activity in your mobile applications and maintain values in visitor profile properties, the channel for your mobile application must be added to a domain in your BlueConic tenant. The very first time that you start your application, BlueConic will detect it. It must then be added as a channel of the type "Mobile App" in a domain. See Managing channels for complete information.

Custom profile properties

If you want your mobile application to be able to add custom properties to visitor profiles and use them in BlueConic segments, those custom profile properties must be added to your plugin. For complete information on writing a custom plugin, see Plugin Types. For information about adding custom profile properties, see profile properties.

Create a position

Connect your UIView element to your ViewController, so your ViewController has a connection/ property of your UI element.
This can be done in a storyboard. Open your storyboard and click on the 'Assistant Editor'-button in the top-toolbar of Xcode, this allows you to have a splitscreen. On the left side you will see the actual storyboard and on the right-side the ViewController bound to the selected view. Hold the 'Control'-key and drag one of the View-elements inside your storyboard to the ViewController. After releasing the mouse button it should show a configuration pop-up, the Connection should be an 'Outlet' and the Name needs to be set. (The name should equal your position id.) Press the connect button; it should look like:

// Swift:
@IBOutlet weak var viewName: UIView!

// Objective-C
@property (strong, nonatomic) IBOutlet UIView* viewName;

The position id of this element is 'viewName' and can be used in the domain as '#viewName'. The BlueConic SDK currently only supports selecting elements using their ids.

See also: How can I test my native mobile app?

 


BlueConic SDK for iOS Release Notes

To see a list of updates and bug fixes for the SDK, see the BlueConic iOS SDK release notes.

 


BlueConic Methods

Implementation of the BlueConic client, handling the profile retrieval and storage. This may be from cache, persistent storage on the client or direct requests to the BlueConic server.

// Swift:
import BlueConicClient

// Objective-C:
#import <BlueConicClient/BlueConic-Swift.h>

getInstance(context: UIViewController?) -> BlueConic

Get an instance of the BlueConic client.
// Swift:
let client: BlueConic = BlueConic.getInstance(self)

// Objective-C:
BlueConic* client = [BlueConic getInstance:self];

Parameters

context

The application context.

Return value

The BlueConic client instance.

 

getProfileId() -> String

Returns the ID of the BlueConic Profile.

Example

// Swift:
let profileId: String = client.getProfileId()

// Objective-C:
NSString* profileId = [client getProfileId];

Return value

The ID of the BlueConic profile.

 

getProfileValue(property: String) -> String

Returns the first value for a given profile property.

Example

// Swift:
let hobby: String = client.getProfileValue("hobby")

// Objective-C:
NSString* hobby = [client getProfileValue:@"hobby"];

Parameters

property

The profile property to get the values for.

Return value

The first value.

 

getProfileValues(property: String) -> [String]?

Return the values for a given profile property.

Example

// Swift:
let hobbies: [String] = client.getProfileValues("hobbies")

// Objective-C:
NSArray* hobbies = [client getProfileValues:@"hobbies"];

Parameters

property

The profile property to get the values for.

Return value

A collection containing the values.

getSegments() -> [BlueConicSegment]

Returns all available segments the profile falls in.

Example

// Swift:
let segments: [BlueConicSegment] = client.getSegments() 

// Objective-C: 
NSArray* segments = [client getSegments];

Return value

All available segments the profile falls in.

 

hasSegment(segmentId: String) -> Bool

Returns whether the profile falls into the segment.

Example

// Swift:
let hasSegment: Bool = client.hasSegment("4a622c61-68d7-4d3e-b5a2-8fd5da43c6a0") 

// Objective-C: 
BOOL hasSegment = [client hasSegment:@"4a622c61-68d7-4d3e-b5a2-8fd5da43c6a0"];

Parameters

segmentId The ID of the segment to check for.

Return value

Whether the profile falls into the segment.

 

getViewController() -> UIViewController?

Returns the current ViewController.

Example

// Swift:
let viewController = client.getViewController()

// Objective-C:
UIViewController* viewController = [client getViewController];

Return value

The current ViewController.

 

getView(selector: String) -> UIView?

 

Returns a view component based on the given identifier or nil is no match is found.

Example

// Swift:
@IBOutlet weak var view: UIView!
let view: UIView? = client.getView("#view")

// Objective-C:
@property (weak, nonatomic) IBOutlet UIView* view;
UIView* view = [client getView:@"#view"];

Parameters

expression

The Identifier, e.g.“#view”.

Return value

The view ornil

 

getScreenName() -> String 

Returns the screenName either set in createEvent or the ViewControllers title.

Example

// Swift:
client.createEvent("PAGEVIEW", properties: ["screenName": "Main/HOMETAB"])
var screenName: String = client.getScreenName()

// Objective-C:
[client createEvent:@"PAGEVIEW" properties:@{@"screenName": @"MAIN/HOMETAB"}];
NSString* screenName = [client getScreenName];

Return value

The screen name.

 

addProfileValue(property: String, value: String)

Adds a single property value to the profile. If there are already values for a property the new value will be added. Values for a property need to be unique; passing the same value multiple times will have no effect.

Example

// Swift:
client.addProfileValue("hobbies", value:"tennis")

// Objective-C:
[client addProfileValue:@"hobbies" value:@"tennis"];

Parameters

property

The profile property to add the values for.

value

The property value to add to the profile.

addProfileValues(property: String, values: [String])

Adds property values to the profile. The values from the collection are added to the profile. If there are already values for a property the new values will be added. Values for a property need to be unique; passing the same values multiple times will have no effect.

Example

// Swift:
let hobbyArray = ["tennis", "soccer"]
client.addProfileValues("hobbies", values:hobbyArray)

// Objective-C:
NSArray* hobbyArray = [NSArray arrayWithObjects:@"tennis", @"soccer", nil];
[client addProfileValues:@"hobbies" values:hobbyArray];

Parameters

property

The profile property to add the values for.

values

The property values to add to the profile.

setProfileValue(name: String, value: String) 

Sets values on the profile. Passing a property that was already set with values will cause for the old values to be removed.

Example

// Swift:
client.setProfileValue("hobbies", value:"tennis")

// Objective-C: 
[client setProfileValue:@"hobbies" value:@"tennis"];

Parameters

property

The profile property to add the values for.

values

The profile values to store.

setProfileValues(name: String, values: [String])

 

Sets values on the profile. Passing a property that was already set with values will cause for the old values to be removed.

Example

// Swift: 
let hobbyArray = ["tennis", "soccer"]
client.setProfileValues("hobbies", values:hobbyArray) 

// Objective-C: 
NSArray* hobbyArray = [NSArray arrayWithObjects:@"tennis", @"soccer", nil];
[client setProfileValues:@"hobbies" values:hobbyArray];

Parameters

property

The profile property to add the values for.

values

The profile values to store.

 

incrementProfileValue(property: String, value: String)

Increments a value on the profile.

Example

// Swift: 
client.incrementProfileValue("hobbiesCount", value: "1")

// Objective-C: 
[client incrementProfileValue:@"hobbiesCount" value:@"1"];

Parameters

property

The profile property to increment the values for.

value

The property value to increment to the profile.

setLocale(locale: String)

Setter for the locale to get the parameters for. By default, the default locale configured in BlueConic is used. Note: The only valid locales currently are 'en_US' and 'nl_NL'.

Example

// Swift: 
client.setLocale("en_US")

// Objective-C: 
[client setLocale:@"en_US"];

Parameters

locale

The locale, e.g.‘en_US’.

setURL(url: NSURL)

Checks whether the app was started with simulator data. If so we try to get the username and the mobile session id to connect to the simulator. The intent should look like: “<appID>://<hostname>/<username>/<mobilesSessionId>”.

Example

// Swift: 
// Implement in AppDelegate.swift 
func application(application: UIApplication, openURL url: NSURL, 
sourceApplication: String?, annotation: AnyObject?) -> Bool { BlueConic.getInstance(nil).setURL(url) return true } // Objective-C: // Implement in AppDelegate.m - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { [[BlueConic getInstance:nil] setURL:url]; return YES; }

Parameters

url

The url retrieved from application.

createEvent(eventType: String, properties: Dictionary<String, String>?)

Registers an event of the specified type with the given properties. For a “PAGEVIEW” event a screen name can be passed, so interactions can be restricted on the where tab in BlueConic. For a “VIEW”, “CLICK”, or “CONVERSION” event an interactionId should be passed to register the event for.

Example

// Swift: 
client.createEvent("PAGEVIEW", properties: ["screenName": "Main/HOMETAB"])
client.createEvent("CLICK", properties: ["interactionId": self._context.getInteractionId()])

// Objective-C: 
[client createEvent:@"PAGEVIEW" properties:@{@"screenName": @"MAIN/HOMETAB"}];
[client createEvent:@"CLICK" properties:@{@"interactionId": 
[self._context getInteractionId]}];

Parameters

eventType

The event type. (e.g:“PAGEVIEW”,“VIEW”,“CLICK”,“CONVERSION”)

properties

A map with properties for the event.

getConsentedObjectives() -> [String]

Return the consented objectives for the current profile.

Example

// Swift:
let consentedObjectives: [String] = client.getConsentedObjectives()

// Objective-C:
NSArray* consentedObjectives = [client getConsentedObjectives];

Return value

A collection containing the consented objectives.

 

getRefusedObjectives() -> [String] 

Return the refused objectives for the current profile.

Example

// Swift:
let refusedObjectives: [String] = client.getRefusedObjectives()

// Objective-C:
NSArray* refusedObjectives = [client getRefusedObjectives];

Return value

A collection containing the consented objectives.

 

addConsentedObjective(_ objectiveId: String)

Adds a single consented objective value to the profile. Values for objectives need to be unique; passing the same value multiple times will have no effect.

Example

// Swift:
client.addConsentedObjective("objective_1")

// Objective-C:
[client addConsentedObjective:@"objective_1"];

Parameters

objectiveId

The ID of the Objective.

   

setConsentedObjectives(_ objectiveIds: [String])

Sets values on the profile. Passing a property that was already set with values will cause for the old values to be removed.

Example

// Swift: 
let objectiveIds = ["objective_1", "objective_2"]
client.setConsentedObjectives(objectiveIds) 

// Objective-C: 
NSArray* objectiveIds = [NSArray arrayWithObjects:@"objective_1", @"objective_2", nil];
[client setConsentedObjectives: objectiveIds];

Parameters

objectiveids

The list of IDs for the objectives to consent to

   

addRefusedObjective(_ objectiveId: String)

Adds a single refused objective value to the profile. Values for objectives need to be unique; passing the same value multiple times will have no effect.

Example

// Swift:
client.addRefusedObjectives("objective_1")

// Objective-C:
[client addRefusedObjective:@"objective_1"];

Parameters

objectiveId

The ID of the Objective.

   

setRefusedObjectives(_ objectiveIds: [String])

Sets values on the profile. Passing a property that was already set with values will cause for the old values to be removed.

Example

// Swift: 
let objectiveIds = ["objective_1", "objective_2"]
client.setRefusedObjectives(objectiveIds) 

// Objective-C: 
NSArray* objectiveIds = [NSArray arrayWithObjects:@"objective_1", @"objective_2", nil];
[client setRefusedObjectives: objectiveIds];

Parameters

objectiveids

The list of IDs for the objectives to consent to

   

 

InteractionContext Methods

Interface InteractionContext

getInteractionId() -> String?

Returns the interaction id.
// Swift: 
let interactionId: String? = context.getInteractionId()

// Objective-C: 
NSString* interactionId = [context getInteractionId];

Return value

The interaction id.

 

getParameters() -> Dictionary<String, [String]>

Returns the interaction parameters in a map.

// Swift: 
let parameters: Dictionary<String, [String]> = context.getParameters()

// Objective-C: 
NSDictinoary* parameters = [context getParameters];

Return value

The parameters.

 

getConnection(id: String) -> Connection?

Returns the connection by id.
// Swift:
let context: InteractionContext!
let connection: Connection? = context.getConnection(connectionId)

// Objective-C:
InteractionContext* context;
Connection* connection = [context getConnection:connectionId];

Return value

The connection.

 

getView() -> UIView?

Returns a view for the interaction.
// Swift: 
let view: UIView? = context.getView()

// Objective-C: 
UIView* view = [context getView];

Return value

The component matching the selector or the position of the interaction or null if no match is found.

 

getPositionIdentifier() -> String?

Returns the ‘selector’ of the position.
// Swift: 
let position: String? = context.getPositionIdentifier()

// Objective-C: 
NSString* position = [context getPositionIdentifier];

Return value

The selector, e.g.#position_1

BlueConicPlugin Methods

Interface BlueConicPlugin

init(client: BlueConic, context: InteractionContext)

Creates a new Plugin instance with Client and an InteractionContext. Function should be overwritten by the Client-plugins.

// Swift:
public required convenience init(client: BlueConic, context: InteractionContext) { 
    self.init()
}

// Objective-C:
- (instancetype) initWithClient: (BlueConic *)client 
context:(InteractionContext *)context { self = [super init]; return self; }

onLoad()

Function onLoad will be triggered when Plugin is registered and active on the server. Function should be overwritten by the Client-plugins.
// Swift:
public func onLoad() {
    // Implementation of the plugin
}

// Objective-C:
- (void) onLoad {
    // Implementation of the plugin
}

onDestroy()

Function onDestroy will be triggered when the ViewController disappears. Function should be overwritten by the Client-plugins.
// Swift:
public func onDestroy() {
    // Implementation of the plugin
}

// Objective-C:
- (void) onDestroy {
    // Implementation of the plugin
}

Connection Methods

Interface Connection

getId() -> String

Returns the id of the connection.
// Swift:
let context: InteractionContext!
let connection: Connection? = context.getConnection(connectionId)
let connectionId = connection.getId()

// Objective-C:
InteractionContext* context;
Connection* connection = [context getConnection:connectionId];
NSString* connectionId = [connection getId];

Return value

The id of the connection.

 

getParameters() -> Dictionary<String, [String]>

Returns the parameters of the connection.
// Swift:
let context: InteractionContext!
let connection: Connection? = context.getConnection(connectionId)
let connectionParameters: Dictionary<String, 
[String]> = connection.getParameters() // Objective-C: InteractionContext* context; Connection* connection = [context getConnection:connectionId]; NSDictionary* connectionParameters = [connection getParameters];

Return value

The parameters of the connection.

Was this article helpful?
0 out of 0 found this helpful