Skip to main content

Xamarin 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

Remove all references to PinchSDK nugets. Kettle does not support nugets due to XCFramework limitations. See Xamarin section to see how to reference the bindings.

Replace imports

Replace all instances of:

  • import Com.Fluxloop.Pinch.Sdk

With:

  • import Kettle.iOS

Replace API calls

PinchX.InitializeWith

AppDelegate.cs
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
KTLConfig config = KTLConfig.KTLDefaultConfig();
config.ProductionApiKey = "<PRODUCTION-API-KEY>";
config.DevelopmentApiKey = "<DEVELOPMENT-API-KEY>";

KTLXamarin.Register();
KTLKettle.Prepare(config, options);
}

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:

  • PinchX.ConsentSurveys to KTLConsent.Surveys
  • PinchX.ConsentAnalytics to KTLConsent.Analytics
  • PinchX.ConsentCampaigns to KTLConsent.Campaigns
  • PinchX.ConsentAds to KTLConsent.Ads

PinchX.GrantWithConsents

var consents = new[] {
KTLConsent.Surveys,
KTLConsent.Analytics,
KTLConsent.Campaigns,
KTLConsent.Ads
}.Select(
consent => NSNumber.FromUnsignedLong((System.nuint)(long) consent)
).ToArray();

KTLKettle.Shared.Grant(consents);

PinchX.RevokeWithConsents

var consents = new[] {
KTLConsent.Surveys,
KTLConsent.Analytics,
KTLConsent.Campaigns,
KTLConsent.Ads
}.Select(
consent => NSNumber.FromUnsignedLong((System.nuint)(long) consent)
).ToArray();

KTLKettle.Shared.Revoke(consents);

PinchX.GrantedConsents

NSNumber[] consents = Kettle.Shared.Obj_grantedConsents

PinchSDK.start

var modules = new[] {
KTLModule.Bluetooth,
KTLModule.Activity,
KTLModule.Location
}.Select(
module => NSNumber.FromUnsignedLong((System.nuint)(long) module)
).ToArray();

KTLKettle.Shared.Start(modules);

PinchX.Start / PinchX.StartLocationProvider / PinchX.StartBluetoothProvider

var modules = new[] {
KTLModule.Bluetooth,
KTLModule.Activity,
KTLModule.Location
}.Select(
module => NSNumber.FromUnsignedLong((System.nuint)(long) module)
).ToArray();

KTLKettle.Shared.Start(modules);

PinchX.Stop / PinchX.StopLocationProvider / PinchX.StopBluetoothProvider

var modules = new[] {
KTLModule.Bluetooth,
KTLModule.Activity,
KTLModule.Location
}.Select(
module => NSNumber.FromUnsignedLong((System.nuint)(long) module)
).ToArray();

KTLKettle.Shared.Stop(modules);

PinchX.IsTracking

var kettleStarted = KTLKettle.Shared.Started;

PinchX.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
KTLKettle.Shared.PushToken = "<PUSH-TOKEN>";

// your identifier for the user
KTLKettle.Shared.ExternalId = "<EXTERNAL-IDENTIFIER>";

// retrieve identifier assigned by Kettle
var kettleId = KTLKettle.Shared.Identifier;

PinchX.PrivacyTermsUrl

var privacyTermsUrl = KTLKettle.Shared.PrivacyTermsUrl;

PinchX.PrivaryDashboardUrl

var privacyDashboardUrl = KTLKettle.Shared.PrivacyDashboardUrl;

PinchX.DeleteCollectedDataOnSuccess

KTLKettle.Shared.DeleteCollectedDataOnSuccess(null);
// or
KTLKettle.Shared.DeleteCollectedDataOnSuccess((didRequestDeletion) => { });

PinchX.RequestBluetoothPermission();

KTLKettle.Shared.RequestBluetoothPermission();

PinchX.SendDemographicProfileWithBirthYear

No migration path available at this time.

PinchX.SetMetadataWithType

No migration path available at this time.

PinchX.AddCustomDataWithType

No migration path available at this time.

PinchX.Adid

This method is obsolete and has been removed.