Integrating iOS SDK

Integrating with the Sample iOS App

Procedure

  1. Add and copy Discover.framework (within the DiscoverDynamic folder created on Desktop) to the project.
  2. Also add Discover.framework to the Genaral > Frameworks, Libraries, and Embedded Content section.
  3. Remove the library added by default in BuildPhases > Link Binary, within Libraries section.
  4. Add DCXCoreSettings and DCFResources folder to the sample project so that you can play around with the settings values. These resource bundle files are available in the Discover project.
  5. In the Appdelegate file, add import Discover and one line of code to make the SDK track events and user actions.
    Add DCFApplicationHelper.sharedInstance().enableDiscoverFramework() in application didFinishLaunching method.
  6. To enable debug logs in the console, add the following code in the environment variables section of edit scheme:
    DCX_DEBUG = 1
    DCF_DEBUG = 1
    IDEPreferLogStreaming = YES

Using Discover Framework Added to the Project

Procedure

  1. Make changes and pass values to the SDK through the files added in the DCXCoreSettings and DCFResources folder.
  2. Post the data from the sample app to the endpoint by adding the post URL in DCFResources > DiscoverBasicConfig > PostMessageUrlEx.
  3. To take screenshot, change the values for params in HCLGlobalScreenSettings dictionary as shown in the following example:
    "takeScreenShot": true,
    "screenShotBlur" : 10
  4. To blur the screenshot with a required value, complete the following steps:
    1. Pass the blur value to the screenShotBlur param in the HCLGlobalScreenSettings of DiscoverLayoutConfig.
    2. Set takeScreenShot value as True.
      This value will be added as the blur value for all the screenshots taken on different screens.
    3. If takeScreenShot value is False in HCLGlobalScreenSettings, no screen shot will be taken in any of the screens.
  5. To take screenshots with different blur values for different screens, complete the following steps:
    1. Set takeScreenShot value as True and pass 0 for screenShotBlur in the HCLGlobalScreenSettings.
    2. Add the following code example in the Activity of the screens where you would want to add the different blur values (the example is passing a blur value of 5):
      DCFApplicationHelper.sharedInstance().addImageBlurValue(5, withScreenShotOnOffValue: true) 
      DCFCustomEvent.sharedInstance().logPrintScreenEvent()
      
      override func viewWillDisappear(_ animated: Bool) {
              super.viewWillDisappear(animated)
              DCFApplicationHelper.sharedInstance().addImageBlurValue(5, withScreenShotOnOffValue: true)
              DCFCustomEvent.sharedInstance().logPrintScreenEvent()
          }
  6. To take screenshots without blur, pass screenShotBlur value as 0 in HCLGlobalScreenSettings or pass the blur value as 0 to the addImageBlurValue method.
  7. In the addImageBlurValue() method, pass the boolean value true to withScreenShotOnOffValue parameter to take the screenshot from code, and in the addImageBlurValue() method, pass the boolean value false to the viewControllers parameter for not taking screenshot for a particular screen.

Creating Distribution Builds or Creating Archives

Procedure

  1. To create an archive or install the sample app with SDK in an actual iOS device, add arm64 architecture to Excluded Architectures section of debug and release the app.
  2. Make the earlier changes for the following targets:
    • Discover, AutoPackageDiscover of Discover project
    • Discover, DiscoverFatFrameworkBeta of DynamicFrameworks project