iOS External Bundles

The Sensibill SDK allows the integrating application to save the configuration file Sensibill.plist, and custom assets (images and strings) in a separate bundle, called external bundle.

To store your configuration and/or asset customization in an external bundle, create a Bundle in the host application’s project and add the files you would like to use to the new bundle.

Note: Files provided in the external bundle will always override the files from default locations. However, the external bundle doesn’t need to contain all the configuration and asset files. If a file is missing in the external bundle, the corresponding file from the default location will be used. For example:

  • If Sensibill.plist is not provided in the external bundle, the SDK will use the Sensibill.plist from the main bundle
  • If an asset is not provided in the external bundle, the default SDK asset will be used

If an external bundle was specified, and it contains an invalid Sensibill.plist, the SDK will skip it, and will try to load the configuration from the main bundle. If reading the configuration from the main bundle fails as well, the error code will reflect the result of main bundle configuration parsing. In this case, inspect the debug log for details of the external bundle parsing failure.

Using External Bundles

By default, the SDK will use the main application bundle to obtain the Sensibill.plist configuration file and pinning certificates. It will also use assets (images and strings) that are provided by the SDK.

If you don’t want to include a configuration file and certificates for pinning in the main bundle, or you want to replace SDK assets (images and strings) with custom ones, perform the following steps prior to starting the SDK:

  1. Create a Bundle instance, pointing to the path of your bundle
  2. Assign a created instance to the SDKConfiguration.shared.externalBundle configuration parameter prior to other interactions with SDK (e.g. prior to start)

In this example, the bundle called SensibillOverride was created to store the Sensibill SDK configuration and assets. The following code ensures the bundle is used by the SDK:

guard let bundleURL = Bundle.main.url(forResource: "SensibillOverride", withExtension: "bundle"),
      let bundle = Bundle(url: bundleURL) else {
    // Failed to locate a specified bundle
    return
}

SDKConfiguration.shared.externalBundle = bundle

Note: To use an externalBundle for custom assets, see Customize Branding . You can use an externalBundle for either or both purposes.