iOS TCF V2

If you want IAB TCF V2 for iOS in other Xcode version, just drop an email to [email protected]

Download AppConsent XcFramework with Kit & UIKit files in it.

XCFramework 1.1.18

Last revision: 2020.12.16

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 sur 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.1.18'
pod 'AppConsentUIKit', '~> 1.1.18'

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.

You can find an example below:

How to use AppConsent

  1. First get your AppKey from our Back Office

  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)

Features of AppConsentUIKit

appconsent.consentGiven()

Return true if consent is given, false otherwise.

Present notice

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

To display AppConsentUI by modal 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.

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.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 Additionnal Consent.The IABTCF_AddtlConsent key is saved on UserDefaultSee https://support.google.com/admanager/answer/9681920?hl=en for more informations

  • WARNING Update for setConsentable 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 externalIdsto 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 compatibilty for setExternalData

[1.1.9] 2020-10-22

  • Fix purpose count bug

[1.1.8] 2020-10-21

  • New button layout component in introducton 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 moddaly, not on fullscreen

  • “Accept All ” button doesn't work

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

  • “Voir les finalites oblihatorie (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

Guide to Install AppConsent

Guide to install AppConsentUIKit

To add the AppConsent SDK to your iOS project, follow the steps below:

  • Drag and drop the AppConsentUIKit.framework and the AppConsentKit.framework file in your xCode project. In the General tab of you application target, make sure the Framework has been added in Frameworks, Libraries and Embedded Content.

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

In build phase in your target project you must create a new run script phase and copy these lines of code. It will remove the simulator architecture for archive and to publish your app on Apple Store.

# Type a script or drag a script file from your workspace to insert its path.
# skip if we run in debug
if [ "$CONFIGURATION" == "Debug" ]; then
echo "Skip frameworks cleaning in debug version"
exit 0
fi
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done

How to use AppConsent

  1. First get your AppKey from our Back Office

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

  3. After that, you can create and initialize AppConsentUIKit like this:let appconsent =

AppConsentUIKit(withAppKey:YOUR_APP_KEY, forceApplyGDPR: true)

Features of AppConsentUIKit

appconsent.consentGiven()

Return trueif consent is given, false otherwise.

Present notice

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

To display AppConsentUI by modal 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.

Stack allowed

appconsent.stackAllowed(iabId: "1")

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

Vendor allowed

appconsent.vendorAllowed(iabId: "1")

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

Set consentable status

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

Set constables status. Warning Key should be an objectId, not an iabId 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(values: ["data": Any])

Set external data and send it to server.

Get external data

appconsent.getExternalData()

Get external data.

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() { ... }