In this guide we will cover how to migrate your app to the latest version of Sourcepoint's SDK (v6). While this migration means more work for you, it also allows for multiple improvements. Below are some reasons to migrate to the latest version of our SDK:
- Your organization no longer needs to integrate with multiple SDKs! The latest version of our SDK supports CCPA, GDPR and ATT pre-prompt message.
- No longer instantiate a
UIViewControllerif there is no message being displayed. - End-users will see a message faster by removing one network call (down from 3 to 2).
Previous version:
lazy var consentViewController: GDPRConsentViewController = { return GDPRConsentViewController(
accountId: 22,
propertyId: 7639,
propertyName: try! GDPRPropertyName("tcfv2.mobile.webview"),
PMId: "122058",
campaignEnv: .Public,
consentDelegate: self
)}()v6 (Unified SDK):
lazy var consentManager: SPConsentManager = { SPConsentManager(
accountId: 22,
propertyName: try! SPPropertyName("mobile.multicampaign.demo"),
campaigns: SPCampaigns(
gdpr: SPCampaign(environment: .Public)
),
delegate: self
)}()GDPRConsentViewControllerhas been renamed toSPConsentManager. We no longer instantiate aUIViewControllerunless there is a message to be displayed.SPCampaignswill accept up to 3 campaigns:gdpr,ccpa, andios14(ATT pre-prompt). They are all of the typeSPCampaignand are all optional.propertyIdis no longer required.PMIdhas been moved to.loadGDPRPrivacyManageror.loadCCPAPrivacyManager. See below.
Previous version:
.loadPrivacyManager()v6 (Unified SDK):
.loadGDPRPrivacyManager(withId: String, tab: SPPrivacyManagerTab)
// or
.loadCCPAPrivacyManager(withId: String, tab: SPPrivacyManagerTab)Changed to:
onSPUIReady(_ controller: SPMessageViewController)The onSPUIReady might be called multiple times, one for each message returned by the scenario.
v6 (Unified SDK):
onAction(_ action: SPAction, from controller: SPMessageViewController)The onAction method hasn't changed much apart from having on extra parameter indicating the ViewController in which the user took that action.
v6 (Unified SDK):
onSPUIFinished(_ controller: SPMessageViewController)The onSPUIFinished might be called multiple times, one for each message that needs to be removed from View stack.
v6 (Unified SDK):
onConsentReady(consents: SPUserData) {- The SDK might call the method
onConsentReadymultiple times (if there are multiple messages being displayed one after the other) however this is not very likely to happen since a real world scenario should not return a CCPA and a GDPR message in the same end-user journey. - We have incorporated all consent data into
SPUserData, composed ofgdpr: SPGDPRConsent?andccpa: SPCCPAConsent?attributes. Note those attributes are optional since an end-user might only have consent on a single legislation or even none (depending on which campaigns are set up).
v6 (Unified SDK):
onError(error: SPError)