iOS TCF V2

Download AppConsent XCFramework with Kit & UIKit files in it.

XCFramework 1.2.12

Last revision: 03.05.2021

2 ways to add AppConsent SDK to your iOS Project.

Drag & Drop XCFramework

Follow the steps below:

  • In General tab of your application target, drag and drop the AppConsentKit.xcframework and the AppConsentUIKit.xcframework in Frameworks, Libraires and Embedded Content. Make sure the XCFrameworks are Embed & Sign.

  • Compatibility xCode 12 and above. Deployment target iOS 11 minimum.

Cocoapods

Now you can install AppConsent SDK with Cocoapods.

In your podfile add this following pod:

pod 'AppConsentKit', '~> 1.2.0'
pod 'AppConsentUIKit', '~> 1.2.0'

Don’t forget to add on top of your podfile these lines:

source 'https://github.com/CocoaPods/Specs.git'
source 'https://gitlab.datalf.chat/dev/appconsentios-private-pod.git'

Run pod install in your command line.

Note: You need at least 1.10.0 pod version to works fine.

You can find an example below:

Swift Package Manager

Now you can install AppConsent SDK with Swift Package Manager.

Note: At the moment, due to some issues of binary target with XCFramework, sub-dependencies andPackage Manager you need to install all packages manually.

AppConsentKit 1.2.2
https://gitlab.datalf.chat/customers/appconsentkit-spm.git
AppConsentUIKit
1.2.2
https://gitlab.datalf.chat/customers/appconsentuikit-spm.git
SwiftProtobuf
1.14.0
https://github.com/apple/swift-protobuf

How to use AppConsent

  1. First get your AppKey from our AppConsent account

  2. You have to import the SDK in your code: import AppConsentUIKit

  3. After that, you can create and initialize ACUIKit like this:

let appconsent = ACUIKit(withAppKey: "YOUR_APP_KEY", forceApplyGDPR: true)

Important

AppConsent SDK supports the new App Tracking Transparency framework (> iOS 14+ available).You must register the NSUserTrackingUsageDescription key in your Info.plist of your applicationotherwise your app will crash.

App Tracking Transparency

Apple release iOS 14.5 few days ago (26 April 2021).

One of the big changes is the new system popup called App Tracking Transparency (ATT). App Tracking Transparency requires apps to get the user’s permission before tracking their data across apps or websites owned by other companies for advertising, or sharing their data with data brokers. Apps can prompt users for permission, and in Settings, users will be able to see which apps have requested permission to track so they can make changes to their choice at any time.

Our last framework (version 1.2.11 +) is fully compatible and integrated with our Content Management Platform. On the App Consent back-office you must turn to on the switch use iOS Att and turn to on the switch disable success screen (for device below iOS 14).

Don't forget to register the NSUserTrackingUsageDescription key in your Info.plist of your application otherwise your app will crash.

Note: If you did not update your application with the last Framework and if your application works on iOS 14.5 device, the IDFA will be 00000-00000-00000-00000.

Floating Purpose - ATT

On the App Consent back-office, you must create an Extra-Purpose for ATT feature.

Steps: Go to Extra-Purposes menu on the left, and click to Add Extra Purpose on the top-right corner. Enter a name, description and select Floating for Type. Save.

On your Notice, click to Edit and on the configuration section add your new Floating Extra Purpose for ATT. Save.

Features of AppConsentUIKit

appconsent.consentGiven()

Return true if consent is given, false otherwise.

Present notice

appconsent.presentNotice(force: true, viewController: self)

To display the CMP by modal mode on your ViewController.

appconsent.consentGiven(success: {
print("Success - Consent Given")
}, failure: { error in
print("Error: \(error)")
})
appconsent.geolocationConsentGiven()

Return true if consent is given, false otherwise.

appconsent.geolocationConsentGiven(success: {
print("Success - Consent Given")
}, failure: { error in
print("Error: \(error)")
})

Consentable allowed - objectId

appconsent.consentableAllowed(objectId: "1")

Return true if consentable with objectId = 1 is allowed, false otherwise.

Consentable allowed - iabId

appconsent.consentableAllowed(iabId: "1")

Return true if consentable with iabId = 1 is allowed, false otherwise.

Consentable allowed - extraId

appconsent.consentableAllowed(extraId: "1")

Return true if consentable with extraId = 1 is allowed, false otherwise.

Stack allowed

appconsent.stackAllowed(iabId: "1")

Return true if consentable with iabId = 1 is allowed, false otherwise.

Vendor allowed - iabId

appconsent.vendorAllowed(iabId: "1")

Return true if consentable with iabId = 1 is allowed, false otherwise.

Vendor allowed - extraId

appconsent.vendorAllowed(extraId: "1")

Return true if consentable with extraId = 1 is allowed, false otherwise.

appconsent.setConsentableConsents(values: ["1": .allowed], success: {
print("Success")
}, failure: { error in
print("Error: \(error)")
})

Set consentables status with an iabId.

Warning Key must be an iabId, not an objectId.

Note this method doesn’t send request to the server.

appconsent.setExtraConsentableConsents(values: ["aaa": .allowed], success: {
print("Success")
}, failure: { error in
print("Error: \(error)")
})

Set consentbles status with extraId.

Warning Key must be an extraId, not an objectId.

Note this method doesn’t send request to the server.

Check for update

appconsent.checkForUpdate({ value in
print("Success: \(value)")
}, failure: { error in
print("Error: \(error)")
})

Check if consent must be updated (new gvl version, new consentables…)

Clear consents

appconsent.clearConsent()

Clear consents on NSUserDefaults, but not on server.

Set external data

appconsent.setExternalData(shipData: ACShipData, success:, failure:)

Set external data with ACShipData model and send it to server.

Set externalIds

appconsent.setExternalIds(externalIds: [String: String])

You can setExternalIds. Behind the scene, externalIds are stored in our cache Framework. If you want, you can save it to our server like this:

appconsent
.setExternalIds(externalIds: [String: String])
.saveExternalIds { state, configuration in
print(state ?? "state nil")
print(configuration ?? "configuration nil")
} failure: { error in
print(error.localizedDescription)
}

Get externalIds

appconsent.getExternalIds() ->[String, String]

Retrieve the externalIds set before.

Open App Settings

appconsent.openAppSettings()

Open App Consent settings in the general tab.

App Tracking is available

appconsent.appTrackingIsAvailable() ->Bool

Check if your device supports App Tracking Transparency.

App Tracking Authorization

appconsent.appTrackingAuthorizationGiven() ->ACATTAuthorizationGiven

Check if App Tracking Transparency has been given.

App Tracking Request

appconsent.appTrackingRequestAuthorization(_ completion: ((ACATTAuthorizationStatus)->Void)?)

Request user authorization. The ATT popup will be display.

Note: the process to display ATT Popup is automatically integrated in AppConsentUIKit when user save hisconsent

Save ATT floating purpose

appconsent.saveATTFloatingPurpose(with value: Bool, _ completion: ACResultVoidHandler?)

Save the ATT user choice and send it to our server.

Floating purpose allowed

appconsent.floatingPurposeAllowed(extraId: String) ->Bool

Check if floating purpose is allowed.

Note: You need to call checkForUpdate method before call this above method to stay up to date.

Display ATT if needed

appconsent.displayATTIfNeeded(_ completion: ((ACATTAuthorizationStatus)->Void)?)

For migrating existing users, you must call this method to display ATT popup without redisplaying CMP.

Note: ATT Popup will only display if user device supports ATT, user given his consent, purpose 1 is true and ATT not yet displaying.

WARNING After that, you need to call new saveATTFloatingPurpose(with value: Bool, _completion: ACResultVoidHandler?) method to send user choice on our server.

Delegate basic implementation

Presenting a notice also take a delegate parameter. It is an object conforming to the AppConsentDelegate protocol. Here are the main methods you'll need to implement.

appconsent.delegate = self
// called when the consent has been given
func appConsentDidFinish() {
print("consent did finish")
}
// called in case of error
func appConsentDidFail(_ error: Error) {
print("consent did fail: \(error.localizedDescription)")
}
func appConsentWillAppear() { ... }
func appConsentDidAppear() { ... }
func appConsentWillDisappear() { ... }
func appConsentDidDisappear() { ... }

Changelog

AppConsent CMP by SFBX®SDK iOS

[1.2.12] 2021-05-04

  • Fix : checkForUpdatewhen ATT is supported, not given, but user RefuseAll. Now returns false instead true

[1.2.11] 2021–04–20

  • New isGDPRCountry() ->Bool public method in AppConsentUIKit.

  • New behavior behind the scene of func presentNotice(force: Bool, viewController:UIViewController) with forceApplyGDPR. Now when forceApplyGDPR is false and use_ios_att from backoffice is true and ATT Authorization is supported and not given on the device, we will display the successScreenpage to collect ATT Authorization only.

public func presentNotice(force: Bool, viewController: UIViewController) {
self.appConsentKit.present(
with: forceApplyGDPR, force: force) { (mode: ACPresentation, configuration: ACConfiguration?) in
switch mode {
case .displayCMPWithIntroduction:
self.presentNoticeIntroduction(viewController)
case .displayCMPWithoutIntroduction:
self.presentNoticeWithoutIntroduction(viewController)
case .displaySuccessScreen:
self.presentSuccessScreen(viewController, configuration)
case .displayNothing:
_print("AppConsent: Display Nothing. ForceApplyGDPR is false and maybe use_ios_att is false, ATT was already presented or not supported.")
break
}
}
}

[1.2.10] 2021–03–31

New getAllConsentables(by: status) ->[ACConsentable]? and getAllExtraVendors(by: status) ->[ACVendor]? public methods.

Note: These methods are only for Swift

[1.2.9] 2021–03–18

New appTrackingAuthorizationStatus() ->ACATTAuthorizationStatus method.Update for checkForUpdate method. Now, check also if use_ios_att:true from configurationand if ATT is already presented.

[1.2.8] 2021–03–05

Fix hidden navigation bar.

[1.2.7] 2021–03–02

  • Layout adjustement on success page. Image size is now 260x260. Title is now on navigation bar. There are more space for header description and footer description also.

[1.2.6] 2021–02–25

  • Fix layout on success page.

[1.2.5] 2021–02–24

  • Supports for iab 2.1. Cookies are displayed in vendors details.Note: You need to re-save notice on back office for displaying cookies.

[1.2.4] 2021–02–09

  • Add new use_ios_att property. Now you can override all logic for displaying ATT from AppConsent. If use_ios_att is true the behavior is the same that specified in documentation.

[1.2.3] 2021–02–04

  • Fix missing IABTCF_gdprApplies set in UserDefault.

  • New currentIdentifier() ->ACCurrentIdentifier method to get current idenfitier and histype

idfv xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

idfa xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

custom xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

  • SwiftProtobuf bump to 1.15.0

[1.2.2] 2021–01–28

  • Bug fixes

  • Supports for Swift Package ManagerNow you can install AppConsentKit, AppConsentUIKit via SPM.View our documentation to find out more.

[1.2.1] 2021–01–21

  • No error popup on banner mode. Modal shoud be dismissed automatically.

  • Fix success screen behavior with ATT from banner mode.

[1.2.0] 2021–01–20

  • Support for App Tracking Transparency (iOS 14+)

  • WARNING You must define NSUserTrackingUsageDescription in your Info.plist otherwise your app will crash.

  • New javascript reducer v22

  • New openAppSettings method.

  • New appTrackingIsAvailable() ->Bool method.

  • New appTrackingAuthorizationGiven() ->ACATTAuthorizationGiven method.

  • NewappTrackingRequestAuthorization(_ completion: ((ACATTAuthorizationStatus)->Void)?) method.

Note: the process to display ATT Popup is automatically integrated in AppConsentUIKit when user save his consent.

  • New saveATTFloatingPurpose(with value: Bool, _ completion:ACResultVoidHandler?) method.

  • New floatingPurposeAllowed(extraId: String) ->Bool method.

Note: You need to call checkForUpdate method before call this above method to stay up to date.

  • New displayATTIfNeeded(_ completion: ((ACATTAuthorizationStatus)->Void)?)method.

For migrating existing users, you must call this method to display ATT Popup without redisplayingCMP.

Note: ATT Popup will only display if user device supports ATT, user given his consent, purpose 1 is true and ATT not yet displaying.

WARNING After that, you need to call new saveATTFloatingPurpose(with value: Bool, _completion: ACResultVoidHandler?) method to send user choice on our server.

Example:

appConsentUIKit.displayATTIfNeeded { status in
switch status {
case .notSupported:
_print("Not supported")
case .failure:
self.appConsentUIKit
.saveATTFloatingPurpose(with: false, nil)
case .success:
self.appConsentUIKit
.saveATTFloatingPurpose(with: true, nil)
}
}

[1.1.18] 2020-12-15

  • Support for xCode 12.3.

    Now our iOS SDK is build and distributed as XCFramework.

  • You must change the class initializer (due to an issue when building XCFramework)

    AppConsentKit has been renamed to ACKit.

    AppConsentUIKit has been renamed to ACUIKit.

    You can (must) remove the run script phase in build phase that removing the simulator architecture for archiving and publishing on App Store.

  • Fix checkForUpdate when user reset his idfa

  • New http call (save-external route) for saveExternalIds in services. Nothing to change.

[1.1.17] 2020-12-09

  • New javascript reducer v20

  • Upgrade SwiftProtobuf to 1.14.0 version

  • Support HTML for Partner Link and Other Partners

    We keep the Markdown support also.

  • Improvements

[1.1.16] 2020-11-26

  • New javascript reducer v19

  • Now you can save externalIds without having to present notice again. The new method is called saveExternalIds (success:, failure:). You can call it with a chaining method after call setExternalIds like this:

appConsentUIKit .setExternalIds(externalIds: ["a": "b"]) .saveExternalIds { state, configuration in print(state ?? "state nil") print(configuration ?? "configuration nil") } failure: { error in print(error.localizedDescription) }

  • Supports for Google Additional Consent.The IABTCF_AddtlConsent key is saved on UserDefaultSee https://support.google.com/admanager/answer/9681920?hl=en for more informations

  • WARNING Update for set Consentable method .The Key for Dictionary must be an iabId instead of an id

  • New method setExtraConsentable.The Key for Dictionary must be an extraId.

  • New method consentableAllowed(extraId).

  • New method vendorAllowed(extraId).

[1.1.15] 2020-11-19

  • Send externalIds to Save request

  • Update setExternalIds method. (Callback is removed)Note: setExternalIds must be call before call presentNotice if you want to send external IDs to server

[1.1.14] 2020-11-12

  • Information button in Vendor details

  • Information button in Vendor details

  • iPad presentation modal improvement (PageSheet)

[1.1.13] 2020-11-10

  • Fix translation

  • Fix extra-vendors. Now others partners are displayed

  • Enable “refine by partner” at launch

[1.1.12] 2020-11-03

  • Add back button to close CMP if consent given and CMP presented from settings

[1.1.11] 2020-10-29

  • Display error in CMP view instead on alertView and hide footer

  • New method setExtternalId

  • Remove externalId from SDK initialization

[1.1.10] 2020-10-27

  • Objective-C compatibility for setExternalData

[1.1.9] 2020-10-22

  • Fix purpose count bug

[1.1.8] 2020-10-21

  • New button layout component in introduction with “I understand” supports

  • Fix translation

[1.1.7] 2020-10-20

  • setExternalIds

  • UI Fixes

  • added missing translations

[1.1.6] 2020-10-15

  • setExternalData

[1.1.5] 2020-10-13

  • Improvements

  • Fix colors

[1.1.4] 2020-10-12

  • Objective-C compatibility

[1.1.3] 2020-10-08

  • Hot fix for button color

[1.1.2] 2020-10-08

  • Improvements

[1.1.1] 2020-10-06

Fixed

  • Hide show more on introduction when show more text is empty

  • Now you can go back when users click on partners in introduction

Release

  • Improvements

  • Reducer v16 (javascript)

[1.1.0] 2020-09-30

Fixed

  • Translation

Release

  • New method consentableAllowed(:objectId) to check extra purpose is allowed for example

  • Consent Given callback is now called on introduction if user click to Accept All

[1.0.9] 2020-09-29

Fixed

  • Translation

Release

  • Supports for extra-purpose

[1.0.8] 2020-09-23

Fixed

  • bitcode bug for archive validation

[1.0.7] 2020-09-17

Unreleased

  • Fix switch UI bug iOS 14 (IPAD)

Fixed

  • remove navigation bar for intro page

  • remove ACState logs

[1.0.6] 2020-09-15

  • Fix onboardingImage (Aspect Fit, height: 80px, width: frame.view.width)

  • Remove copyright on first page

  • Fix markdown link on more description label (first page)

[1.0.5] 2020-09-14

  • Fix Colors

  • Fix redirect links in markdown

  • Fix remote image for Onboarding - onboardingImage

  • Add mixe stacks

  • Add footer copyright

  • Add remote image in home page - icon

  • Add colors to success page

  • Add separator color

[1.0.4] 2020-09-09

Added

  • Remote Config for colors

  • Disable success screen config

  • Purposes behind a stack

  • Default text in markdown in the BO

  • 11.2 release

  • 11.6+ release

Fixed

  • UI fixes

[1.0.2] 2020-09-07

Added

  • bitcode compilation compatibility

  • 11.2 release

  • 11.6+ release

Fixed

  • view is present modal, not on fullscreen

  • “Accept All ” button doesn't work

  • getExternalData() method is declared a void function which doesn’t return any value

  • “Voir les finalités obligatoires (2)” button doesn’t work

  • getConsentableConsents() callback doesn’t call any call back either success nor error, and after that method to check this consentable return false

  • [SFBX library] When the consent is opened: there are UI issues in logs. And some of the buttons, links don’t work

  • [SFBX library] Each time consentGiven method returns false

  • [iOS][SFBX] Library delegate “AppConsentDelegate” doesn’t call lifecycle methods

Removed

  • getExternalData

Contents
XCFramework 1.2.12
Drag & Drop XCFramework
Cocoapods
Swift Package Manager
How to use AppConsent
App Tracking Transparency
Floating Purpose - ATT
Features of AppConsentUIKit
Check if user gave consent
Present notice
Closure to consent given
Check if user gave Geolocation consent
Closure to Geolocation consent
Consentable allowed - objectId
Consentable allowed - iabId
Consentable allowed - extraId
Stack allowed
Vendor allowed - iabId
Vendor allowed - extraId
Set consentable consent
Set extra consentable consent
Check for update
Clear consents
Set external data
Set externalIds
Get externalIds
Open App Settings
App Tracking is available
App Tracking Authorization
App Tracking Request
Save ATT floating purpose
Floating purpose allowed
Display ATT if needed
Delegate basic implementation
Changelog
[1.2.11] 2021–04–20
[1.2.10] 2021–03–31
[1.2.9] 2021–03–18
[1.2.8] 2021–03–05
[1.2.7] 2021–03–02
[1.2.6] 2021–02–25
[1.2.5] 2021–02–24
[1.2.4] 2021–02–09
[1.2.3] 2021–02–04
[1.2.2] 2021–01–28
[1.2.1] 2021–01–21
[1.2.0] 2021–01–20
[1.1.18] 2020-12-15
[1.1.17] 2020-12-09
[1.1.16] 2020-11-26
[1.1.15] 2020-11-19
[1.1.14] 2020-11-12
[1.1.13] 2020-11-10
[1.1.12] 2020-11-03
[1.1.11] 2020-10-29
[1.1.10] 2020-10-27
[1.1.9] 2020-10-22
[1.1.8] 2020-10-21
[1.1.7] 2020-10-20
[1.1.6] 2020-10-15
[1.1.5] 2020-10-13
[1.1.4] 2020-10-12
[1.1.3] 2020-10-08
[1.1.2] 2020-10-08
[1.1.1] 2020-10-06
[1.1.0] 2020-09-30
[1.0.9] 2020-09-29
[1.0.8] 2020-09-23
[1.0.7] 2020-09-17
[1.0.6] 2020-09-15
[1.0.5] 2020-09-14
[1.0.4] 2020-09-09
[1.0.2] 2020-09-07