Skip to main content

Native iOS

This page describes how to migrate your application from using PinchSDK to Kettle.

Before you begin​

This page assumes that you fulfill the requirements to implement Kettle.

The iOS target has been increased from 9.0 to 11.0. Everything below 11.0 is marked as obsolete by Apple.

Replace references to PinchSDK​

In your applications Podfile, remove the following pods:

Podfile
pod 'PinchSDK', 'x.x.x'
pod 'PinchSDKLegacy', 'x.x.x'
pod 'PinchSDKLegacyBluetooth', 'x.x.x'

Add the following pod:

Podfile
pod 'KettleKit', 'x.x.x' 

Add the following background modes:

location
bluetooth-central

Replace imports​

Replace all instances of:

  • import PinchSDK

With:

  • import KettleKit

Replace API calls​

PinchSDK.initialize​

AppDelegate.swift
let kettleConfig = KettleConfig.default()
kettleConfig.developmentApiKey = "<DEVELOPMENT-API-KEY>"
kettleConfig.productionApiKey = "<PRODUCTION-API-KEY>"
Kettle.prepare(config, launchOptions: launchOptions)

Additionally, the configuration has the following fields available:

  • inProduction: Production status for the application. This value is used by Kettle to determine if the application is in production. If this value is not set, Kettle will set this value based on the application build scheme.
  • developmentLogLevel: Log level used for development apps.
  • productionLogLevel: Log level used for production apps.

Consents​

All instances of fully qualified consents should be replaced from and to:

  • PinchSDK.Consent.surveys to KettleConsent.surveys
  • PinchSDK.Consent.analytics to KettleConsent.analytics
  • PinchSDK.Consent.campaigns to KettleConsent.campaigns
  • PinchSDK.Consent.ads to KettleConsent.ads

PinchSDK.grant​

Kettle.shared.grant(consents: [.ads, .analytics, .campaigns, .ads])

PinchSDK.revoke​

Kettle.shared.revoke(consents: [.ads, .analytics, .campaigns, .ads])

PinchSDK.grantedConsents​

Kettle.shared.grantedConsents

PinchSDK.start​

Kettle.shared.start(with: [.bluetooth, .location, .activity])

PinchSDK.stop​

Kettle.shared.stop(with: [.bluetooth, .location, .activity])

PinchSDK.isTracking​

let started: Bool = Kettle.shared.started

PinchSDK.messagingId​

This method was used to either retrieve the internal identifier assigned by Pinch, set an external identifier or send push tokens. This method is now obsolete and has been replaced by three variables, responsible for each part.

// send push token
Kettle.shared.pushToken = "<PUSH-TOKEN>"

// your identifier for the user
Kettle.shared.externalId = "<EXTERNAL-IDENTIFIER>>"

// retrieve identifier assigned by Kettle
let identifier: String = Kettle.shared.identifier

PinchSDK.privacyTermsUrl​

let privacyTermsUrl: String = Kettle.shared.privacyTermsUrl

PinchSDK.getPrivacyDashboard​

let privacyDashboardUrl: String = Kettle.shared.privacyDashboardUrl

PinchSDK.deleteCollectedData​

Kettle.shared.deleteCollectedData() { dataDeleted in
if dataDeleted {
...
}
}

PinchSDK.requestBluetoothPermission​

Kettle.shared.requestBluetoothPermission()

PinchSDK.sendDemographicProfile​

No migration path available at this time.

PinchSDK.setMetadata​

let type = "name"
var metadata: [String : AnyHashable] = [:]
metadata["nick_name"] = "nick"

Kettle.shared.setMetadata(type: type, metadata: metadata)

PinchSDK.addCustomData​

let type = "order"
var event: [String : AnyHashable] = [:]
event["orderId"] = 12

Kettle.shared.addCustomEvent(type: type, event: event)

PinchSDK.getGender​

No migration path available at this time.

PinchSDK.adid​

This method is obsolete and has been removed.