Make sure, your Sourcepoint CMP has been set up at its backend dashboard. Our support recommends certain vendors to be included in your server-side setup in order to yield optimal revenues. Please also refer to your SourcePoint CMP documentation.
Pass the created AATCMPSourcepoint instance while initializing the AATManagedConsent using the public init?(cmp: AATCMPProtocol?, delegate: AATManagedConsentDelegate) method.
@UIApplicationMainclassAppDelegate:UIResponder, UIApplicationDelegate {...funcconfigureAATKit() {let configuration =AATConfiguration() configuration.delegate = self let cmp = AATCMPSourcepoint(accountId: "accountId", propertyId: "propertyId", propertyName: "propertyName", pmId: "pmId")
var consent =AATManagedConsent(cmp: cmp, delegate: self) configuration.consent = consent AATSDK.initAATKit(with: configuration) consent?.showIfNeeded(<ROOT VIEW CONTROLLER>) OR consent?.showIfNeededOrRejected(daysAgo:1, viewController:<ROOT VIEW CONTROLLER>) }...}// MARK: - AATManagedConsentDelegateextensionAppDelegate:AATManagedConsentDelegate {funcmanagedConsentNeedsUserInterface(_managedConsent: AATManagedConsent) {// CMP is loaded and ready to be shown// Show the CMP using the root view controller managedConsent.showIfNeeded(<ROOT VIEW CONTROLLER>) }funcmanagedConsentCMPFinished(withstate: AATManagedConsentState) {// The user finished his action with CMP with the state as the user chosen state }funcmanagedConsentCMPFailedToLoad(_managedConsent: AATManagedConsent, witherror: String) {// CMP failed to load with the error message.// Reload the CMP using the root view controller managedConsent.reload(<ROOT VIEW CONTROLLER>) }funcmanagedConsentCMPFailedToShow(_managedConsent: AATManagedConsent, witherror: String) {// CMP failed to show with the error message }}
@implementation AppDelegate
...
- (void)configureAATKit {
AATConfiguration *configuration = [[AATConfiguration alloc] init];
configuration.delegate = self;
AATCMPSourcepoint *cmp = [[AATCMPSourcepoint alloc]initWithAccountId:@"accountId" propertyId:@"propertyId" propertyName:@"propertyName" pmId:@"pmId"];
AATManagedConsent *consent = [[AATManagedConsent alloc] initWithCmp:cmp delegate:self];
configuration.consent = consent;
[AATSDK initAATKitWith:configuration];
[consent showIfNeeded:<ROOT VIEW CONTROLLER>];
OR
[self.consent showIfNeededOrRejectedWithDaysAgo:1 viewController:<ROOT VIEW CONTROLLER>];
}
...
#pragma mark - AATManagedConsentDelegate
- (void)managedConsentNeedsUserInterface:(AATManagedConsent * _Nonnull)managedConsent {
// CMP is loaded and ready to be shown
// Get the rootViewController
[managedConsent showIfNeeded:<ROOT VIEW CONTROLLER>];
}
- (void)managedConsentCMPFinishedWith:(enum AATManagedConsentState)state {
// The user finished his action with CMP with the state as the user chosen state
}
- (void)managedConsentCMPFailedToLoad:(AATManagedConsent * _Nonnull)managedConsent with:(NSString * _Nonnull)error {
// CMP failed to load with the error message.
// Get the rootViewController
[managedConsent reload:<ROOT VIEW CONTROLLER>];
}
- (void)managedConsentCMPFailedToShow:(AATManagedConsent * _Nonnull)managedConsent with:(NSString * _Nonnull)error {
// CMP failed to show with the error message
}
@end