Download AppConsent XcFramework with Kit & UIKit files in it.
Last revision: 2020.12.16
2 ways to add AppConsent SDK to your iOS Project.
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.
You need to install SwiftProtobuf
with Swift Package Manager. Current version is 1.14.0
. The url of repo is https://github.com/apple/swift-protobuf
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:
First get your AppKey from our Back Office
You have to import the SDK in your code: import AppConsentUIKit
After that, you can create and initialize ACUIKit
like this:
let appconsent = ACUIKit(withAppKey: "YOUR_APP_KEY", forceApplyGDPR: true)
appconsent.consentGiven()
Return true
if consent is given, false
otherwise.
appconsent.presentNotice(force: true, viewController: self)
To display AppConsentUI by modal on your ViewController.
appconsent.consentGiven(success: {print("Success - Consent Given")}, failure: { error inprint("Error: \(error)")})
appconsent.geolocationConsentGiven()
Return true
if consent is given, false
otherwise.
appconsent.geolocationConsentGiven(success: {print("Success - Consent Given")}, failure: { error inprint("Error: \(error)")})
appconsent.consentableAllowed(objectId: "1")
Return true
if consentable with objectId = 1
is allowed, false
otherwise.
appconsent.consentableAllowed(iabId: "1")
Return true
if consentable with iabId = 1
is allowed, false
otherwise.
appconsent.consentableAllowed(extraId: "1")
Return true
if consentable with extraId = 1
is allowed, false
otherwise.
appconsent.stackAllowed(iabId: "1")
Return true
if consentable with iabId = 1
is allowed, false
otherwise.
appconsent.vendorAllowed(iabId: "1")
Return true
if consentable with iabId = 1
is allowed, false
otherwise.
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 inprint("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 inprint("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.
appconsent.checkForUpdate({ value inprint("Success: \(value)")}, failure: { error inprint("Error: \(error)")})
Check if consent must be updated (new gvl version, new consentables…)
appconsent.clearConsent()
Clear consents on NSUserDefaults
, but not on server.
appconsent.setExternalData(shipData: ACShipData, success:, failure:)
Set external data with `ACShipData` model and send it to server.
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 inprint(state ?? "state nil")print(configuration ?? "configuration nil")} failure: { error inprint(error.localizedDescription)}
appconsent.getExternalIds() ->[String, String]
Retrieve the externalIds set before.
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 givenfunc appConsentDidFinish() {print("consent did finish")}// called in case of errorfunc appConsentDidFail(_ error: Error) {print("consent did fail: \(error.localizedDescription)")}func appConsentWillAppear() { ... }func appConsentDidAppear() { ... }func appConsentWillDisappear() { ... }func appConsentDidDisappear() { ... }
AppConsent CMP by SFBX®SDK iOS
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.
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
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 UserDefault
See 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).
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
Information button in Vendor details
Information button in Vendor details
iPad presentation modal improvement (PageSheet)
Fix translation
Fix extra-vendors. Now others partners are displayed
Enable “refine by partner” at launch
Add back button to close CMP if consent given and CMP presented from settings
Display error in cmp view instead on alertView and hide footer
New method setExtternalId
Remove externalId
from sdk initialization
Objective-C compatibilty for setExternalData
Fix purpose count bug
New button layout component in introducton with “I understand” supports
Fix translation
setExternalIds
UI Fixes
added missing translations
setExternalData
Improvements
Fix colors
Objective-C compatibility
Hot fix for button color
Improvements
Hide show more
on introduction when show more text is empty
Now you can go back when users click on partners
in introduction
Improvements
Reducer v16 (javascript)
Translation
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
Translation
Supports for extra-purpose
bitcode bug for archive validation
Fix switch UI bug iOS 14 (IPAD)
remove navigation bar for intro page
remove ACState logs
Fix onboardingImage (Aspect Fit, height: 80px, width: frame.view.width)
Remove copyright on first page
Fix markdown link on more description label (first page)
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
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
UI fixes
bitcode compilation compatibility
11.2 release
11.6+ release
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
getExternalData
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
You have to install SwiftProtobuf
with Swift Package Manager. Current version is 1.12.0
. The url of repo is https://github.com/apple/swift-protobuf
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 debugif [ "$CONFIGURATION" == "Debug" ]; thenecho "Skip frameworks cleaning in debug version"exit 0fiAPP_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 FRAMEWORKdoFRAMEWORK_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 $ARCHSdoecho "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")doneecho "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
First get your AppKey from our Back Office
You have to impor t the SDK in your code: import AppConsentUIKit
After that, you can create and initialize AppConsentUIKit
like this:let appconsent =
AppConsentUIKit(withAppKey: “YOUR_APP_KEY”, forceApplyGDPR: true)
appconsent.consentGiven()
Return true
if consent is given, false
otherwise.
appconsent.presentNotice(force:true, viewController: self)
To display AppConsentUI by modal on your ViewController.
appconsent.consentGiven(success: {print("Success - Consent Given")}, failure: { error inprint("Error: \(error)")})
appconsent.geolocationConsentGiven()
Return true
if consent is given, false
otherwise.
appconsent.geolocationConsentGiven(success: {print("Success - Consent Given")}, failure: { error inprint("Error: \(error)")})
appconsent.consentableAllowed(objectId: "1")
Return true
if consentable with objectId = 1
is allowed, false
otherwise.
appconsent.consentableAllowed(iabId: "1")
Return true
if consentable with iabId = 1
is allowed, false
otherwise.
appconsent.stackAllowed(iabId: "1")
Return true
if constable with iabId = 1
is allowed, false
otherwise.
appconsent.vendorAllowed(iabId: "1")
Return true
if constable with iabId = 1
is allowed, false
otherwise
appconsent.setConsentableConsents(values: ["1": .allowed], success: {print("Success")}, failure: { error inprint("Error: \(error)")})
Set constables status. Warning Key
should be an objectId
, not an iabId
Note this method doesn’t send request to the server.
appconsent.checkForUpdate({ value inprint("Success: \(value)")}, failure: { error inprint("Error: \(error)")})
Check if consent must be updated (new gvl version, new consentables…)
appconsent.clearConsent()
Clear consents on NSUserDefaults
, but not on server.
appconsent.setExternalData(values: ["data": Any])
Set external data and send it to server.
appconsent.getExternalData()
Get external data.
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 givenfunc appConsentDidFinish() {print("consent did finish")}// called in case of errorfunc appConsentDidFail(_ error: Error) {print("consent did fail: \(error.localizedDescription)")}func appConsentWillAppear() { ... }func appConsentDidAppear() { ... }func appConsentWillDisappear() { ... }func appConsentDidDisappear() { ... }