Using Multiple Hybrid Web Containers on the Same iOS Device

You can configure two or more Hybrid Web Containers to coexist on the same device.

This customization allows two or more independent users to use the same device, but with their own private version of the application. In summary, you need to change the application ID, the bundle identifier, and possibly the URL scheme.

The application ID is used by the server to identify the application, and because of this, you cannot run two applications on the same device with the same application ID. By default, the Hybrid Web Container uses “HWC” for its application ID. Changing the application ID involves a minor change to CustomizationHelper.m. Additionally, you must signify to iOS that this is a distinct application. This requires a minor change to update the application bundle ID in the plist file. Finally, if your application needs to communicate with the Afaria client for provisioning your application or retrieving a certificate, you need to specify a unique URL scheme in the plist file. If your application does not need to communicate with the afaria client, then you should delete the “URL types” item from the same plist file.

  1. Change the project name:
    1. In the Xcode Project Navigator, click on the root Hybrid Web Container element.
    2. With the Hybrid Web Container element highlighted click on the Hybrid Web Container text to rename.
    3. Change the name of the Hybrid Web Container element to your new project name.
    4. A window to rename project content items appears. Click Rename.
  2. Change the application ID:
    1. In Xcode Project Navigator, find and open the CustomizationHelper.m file, which is located in the Classes group folder,
    2. Locate the customization point that accompanies the getAppId function, and change it so that it returns a unique name.
    3. Save and close the file.
  3. To differentiate this version of the Hybrid Web Container from another:
    1. In Xcode Project Navigator, find and open the HWC-Info.plist file, which is located in the Resources group folder.
    2. Change the bundle identifier value to something unique.
    3. Save and close the file.
      The container template project has a URL schema setting in the project plist file, which is used to communicate with Afaria client.
  4. To avoid multiple container applications from interfering with each other when communicating with the Afaria client, the URL schema must be unique among all container applications that are installed on the device, otherwise, the application may be launched by the afaria client by mistake, or fail to launch altogether.
    1. In Xcode Project Navigator, find and open the HWC-Info.plist file, which is located in the Resources group folder.
    2. Expand the URL types item > Item 0 > URL Schemes item.
    3. Select Item 0, and change its value to a unique value among all other applications.
    4. Save and close the file.