How to Integrate Privacy Pillar Privacy Manager with your iOS Mobile App?

Introduction

To simplify publishing your cookie banner and obtaining your visitor's consent, we've introduced a user-friendly Privacy Pillar Privacy Manager app, which you can integrate with your iOS mobile app.

Steps to Integrate:-  

Prerequisites:

Before integrating Privacy Pillar Privacy Manager, you must complete the following tasks.

Follow the Below Steps to Integrate

  1. Create a new project by selecting Swift Language, refer to the below screenshot.
  2. Drag the AdzapierCMPSDK.framework file into the root folder of the existing or newly created Xcode project.
  3. To ensure the framework is added to the project go to the General section of the Xcode project. The CMP SDK framework entry should be added to the Framework section. In the Embed section choose the option Embed without signing.
    Refer to the below screenshots.

  4. Please add the below pods dependencies into the pod file and then run the pod install command from cli to the main project.
            # Comment the next line if you don't want to use dynamic frameworks  use_frameworks!    post_install do |installer|      installer.generated_projects.each do |project|            project.targets.each do |target|                target.build_configurations.each do |config|                    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'                 end            end     end  end   # Pods for AdzapierCMPSDK  pod 'DropDown'  pod 'ConsentViewController', '6.7.0'  pod 'IHProgressHUD'  pod 'SwiftLint'  pod 'IQKeyboardManagerSwift'  pod 'XLPagerTabStrip' end
  5. if the pod file is not present in the root folder then create it using the pod init command. Then open it using the below cli command.
    open -a Xcode Podfile. Then repeat step 4 again.
  6. Close the .xcodeproj editor and open .xcworkspce in Xcode.
  7. Import the AdzapierCMPSDK.Module into the View Controller, from where you want to launch Adzapier CMP SDK.
  8. Remove the code snippet related to Scene Manifest from your AppDelegate file. Should be something along the lines as follows.
  9. Also, remove all the entries of the Application Scene Manifest section from the Info.plist file which you search in the app source code.
    - Refer to the below screenshot
     
  10. In order to launch the CMP SDK UI interface on the Action event of the View Controller, call the below code inside View Controller with the required parameters orgID and propID as mentioned below.
    import UIKitimport AdzapierCMPSDKclass ViewController: UIViewController {    @IBOutlet weak var btnCMPSDKAction: UIButton!    @IBOutlet weak var lblConsentString: UILabel!    public var consentString: String?    override func viewDidLoad() {        super.viewDidLoad()        // Do any additional setup after loading the view.                self.btnCMPSDKAction.addTarget(self,action: #selector(self.navigateToCMPSDK), for: .touchUpInside)        /* After submitting consents consent string will receive in below mention callback printValue which will get dictionary object with key consent_string parameter that can be used in for display purpose or tracking purpose */        NotificationCenter.default.addObserver(self, selector: #selector(printValue), name: NSNotification.Name(rawValue: "printValue"), object: nil)            }           @objc func printValue(notification:NSNotification) {        let userInfo:Dictionary<String,String> = notification.userInfo as! Dictionary<String,String>        let item = userInfo["consent_string"]! as String        DispatchQueue.main.async {            self.lblConsentString.text = "Consent String \(item)"        }       // print(item,self)    }    /* function for initiating Adzapier CMP SDK which can be called on action listener of the view */     @IBAction func navigateToCMPSDK() {                        if let wd = UIApplication.shared.delegate?.window {                var vc = wd!.rootViewController                if(vc is UINavigationController){                    vc = (vc as! UINavigationController).visibleViewController                }                if(vc is ViewController){                    let bundle = Bundle(identifier: "adz.com.AdzapierCMPSDK")                    let launchScreenVC  = UIStoryboard.init(name: Storyboard.kLaunchScreen, bundle: bundle)                    let rootVC = launchScreenVC.instantiateViewController(withIdentifier: ViewControllerVCID.kSplashScreen)                    self.present(rootVC, animated: true, completion: nil)                    let appDelegate = UIApplication.shared.delegate as! AppDelegate                    appDelegate.window = UIWindow(frame: UIScreen.main.bounds)                    let kOrganiserId = "084c2317-469d-4847-9932-8607e9e800d9"                    let kPropertyId = "97d57fba-e1a5-409b-a064-49cf534827db"                    CMPSDKManager.shared.setSplashScreen(appDelegate: appDelegate, orgId: kOrganiserId, propID: kPropertyId, vc: vc!)                                    }            }                }}
  11. Also, add the below two lines in AppDelegate class in the variable declaration section.
    public var window: UIWindow?public var rootNavController: UINavigationController?
  12.  Run the application on the simulator or device it will display a screen once the event triggers.