Skip to content

iOS

Hive SDK for iOS provides a promotion feature. This document describes how to configure an iOS app to use the promotion feature.

Adding the framework

Add the framework to the Podfile in your project directory. For detailed instructions, see Adding the Framework.

pod 'HivePromotion', $HIVE_SDK_VERSION # Framework for the Promotion feature

After saving the Podfile with the framework added, execute the following command to install the framework to your project.

pod install

A deep link is a link that takes a user to a specific location in an app after the app is launched. Hive SDK for iOS supports handling deep link schemes in Promotion User Engagement.

  1. In the Xcode project window, select your project in the Project navigator.
  2. Select your app from the TARGETS list.
  3. Click the Info tab.
  4. Click the URL Types item in the Info tab.
  5. Click the + icon to create the Additional url type properties item.
  6. Enter your App ID in both the Identifier and URL Schemes fields under the Additional url type properties item.

Using the following code, you can create an HTML page to display in an app where the game is installed to test the URL Scheme behavior. Note that the link address must be the same as the URL set when configuring the deep link.

<a href="com.com2us.myapp://">TEST</a>

Setting up deferred deep links (universal link)

Universal Link enables app installation and launch through invitation pages, as well as inviter rewards, for the first time. Hive SDK for iOS supports both URI Scheme-based and Universal Link-based deferred deep links.

Inviting users and rewarding inviters through Universal Link-based invitation links require the UIPasteboard paste system permission. When an invited user installs and launches the app for the first time using an invitation link, a toast popup might appear for iOS versions below 16.1 and a system permission request popup might appear for iOS 16.1 and above. To prevent the system permission request popup from appearing, refer to the Promotion Operation Guide on the Developer website and disable the deferred deep link setting.

iOS below 16.1

iOS 16.1 and above
Note

For additional console setup instructions for generating Universal Link-based inviter links, refer to the Promotion Operation Guide on the Developer website.
Developers cannot customize the text of the system permission request popup.

Xcode project settings

Select the main TARGETS of your Xcode project and configure Domains as below in the Associated Domains section of the Signing & Capabilities tab.

  • applinks:sandbox-promotion.qpyou.cn: The Universal Link domain that operates in the Hive sandbox server environment.
  • applinks:promotion.qpyou.cn: The Universal Link domain that operates in the Hive commercial server environment.

Server setup

Modify the following values listed in the given format to your environment and save it as apple-app-site-association.

  • TEAM ID: TEAM ID found in the Apple Developer Console
  • Bundle Identifier: Bundle ID of the app that will use the Universal Link
  • URL Path: HTTP URL to support Universal Link

Upload to the web server's root or the .well-known subdirectory. While the format of the apple-app-site-association file is JSON, it does not have an extension.

{
   "applinks": {
       "apps": [],
       "details": [
           {
               "appID": "--TEAM ID.--Bundle Identifier",
               "paths": ["--URL Path"]
           }
       ]
   }
}

The following is an example from Apple.

{
   "applinks": {
       "apps": [],
       "details": [
           {
               "appID": "9JA89QQLNQ.com.apple.wwdc",
               "paths": ["/wwdc/news/", "/videos/wwdc/2015/*"]
           }, {
               "appID": "ABCD1234.com.apple.wwdc",
               "paths": ["*"]
           }
       ]
   }
}

iOS app setup

Follow the instructions below in your Xcode project.

  1. In the Xcode project window, select your project in the Project navigator.
  2. Select your app from the TARGETS list.
  3. Click the Signing & Capabilities tab.

  4. Click the + Capability button at the top left of the Signing & Capabilities tab.

  5. Select and add Associated Domains from the list. applinks:[apple-app-site-association] the domain where it was uploaded (Example: applinks:hive-ota.withhive.com)

  6. Enable Associated Domains in the app's Capabilities in the Apple Developer Console.

hive_config.xml setup

Add/Modify the hive_config.xml file as follows:

<universalLink>Universal link address (Domain/Path) </universalLink>