Skip to content

iOS

Adiz iOS

Adiz iOS is an advertising module for iOS provided on the Hive platform to make it easier to use the ad exposure features offered by AdMob. The types of ads provided by Adiz iOS are as follows.

  • Interstitial Ads
  • Banner Ads
  • Native Ads
  • Rewarded Ads
  • Rewarded Interstitial Ads
  • App Open Ads

To install and use Adiz iOS, please refer to the guide below in order.

Preparation

Set up the Adiz iOS development environment.

Installation

Add the GADApplicationIdentifier key to the Info.plist file of your Xcode project, and enter the AdMobId value (in the format ca-app-pub-XXXXX~YYYYY) as the value for the key.

    <key>GADApplicationIdentifier</key>
    <string>ca-app-pub-XXXXX~YYYYY</string>

 

Additionally, for iOS 14 and above, refer to the Update your info.plist guide to add the SKAdNetwork list to the Info.plist file.

 

After that, add the following content to the CocoaPods configuration (Podfile) of the project.

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/Com2uSPlatformCorp/HiveAdiz-iOS.git'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'HiveAdiz', '2.1.3'
end
target 'Unity-iPhone' do
end
use_frameworks!

# fix for dyld issue in pods when using Project
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # xcode 15 Toolchain Issue
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
      File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
      # end

      config.build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "YES"
      if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 12.0
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
      end
    end
  end
end

 

Apply CocoaPod settings with $pod install.

Test Ad settings

Adiz can display test ads in two ways.

  1. Activate test mode: Only test ads issued by AdMob will be displayed
  2. Display ads after registering test devices: Display actual ads for testing, ensuring no invalid traffic occurs, and proceed by registering devices that will display test ads

Activate test mode

In the development stage, activate the test mode so that clicking on test ads does not charge advertisers. When the test mode is activated, only test ads will be displayed. In test mode, test ads will be displayed even if the AdMob ad key is not entered in the console. Disable the test mode during commercial distribution.

There are two ways to activate test mode.

  • After registering the test device in the Hive console, set it to demo ad (recommended):
    Please refer to the Test Device Management section of the console guide.
  • Use the Adiz class's setTestMode() method:
    Refer to the example code below.
Note

When not in test mode during the development stage, excessive clicks on ads may be considered invalid traffic, and your AdMob account may be reported, preventing ads from being displayed.

Using the Adiz.setTestMode() method

import HiveAdiz

// Activates test mode. Comment out the line below for production deployment.
Adiz.setTestMode(true)

// Activates Adiz module logging. Logging should only be used in test mode. Comment out the line below for production deployment.
Adiz.setLogEnable(true)
#import <HiveAdiz/HiveAdiz-Swift.h> 

// Activates test mode. Comment out the line below for production deployment.
[Adiz setTestMode: true];

// Activates Adiz module logging. Logging should only be used in test mode. Comment out the line below for production deployment.
[Adiz setLogEnable: true];

Test device advertising exposure

In the following situations, you need to register a test device to display test advertisements.

  • Testing if the AdMob ad key registered in the console is working properly
  • Writing a GDPR message and checking if the GDPR consent popup works correctly
  • Running the ad inspector to analyze and debug ad requests



<

There are two ways to display ads on the test device.

  • After registering the test device in the Hive console, set it to Use Ad Unit ID (recommended):
    Please refer to the contents of Managing Test Devices in the console guide.

  • Use the Adiz class's setTestDevice() method:
    Please refer to the example code below.

Note

If you conduct a test that exposes actual ads without registering a test device, it may be considered invalid traffic, and your AdMob account could be blocked, preventing further ad exposure. When you register a test device, "Test Mode" or "Test Ad" (native ads) will be displayed during ad exposure. You must deactivate the test device during commercial distribution.

 

Banner, full-screen ads, or rewarded ads

 

Native advertising

 

Using the Adiz.setTestDevice() method

To register a test device, you first need to check the test device ID. The test device ID (for example: B74F6468-1516-467C-99AD-CC5973C5DB52) can be confirmed in the following two ways.

  1. Adiz.Initialize() call and check the Logcat logs:
    To enable debug mode for this device, set: UMPDebugSettings.testDeviceIdentifiers = @[B74F6468-1516-467C-99AD-CC5973C5DB52]
    
  2. After calling Adiz.Initialize(), regardless of the ad type, check the Logcat logs after calling initialize()load():
    GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ "B74F6468-1516-467C-99AD-CC5973C5DB52" ]
    

 

After checking the test device ID, add the line Adiz.SetTestDevice(DEVICE_ID) before executing Adiz.initialize in the existing Hive Adiz initialization code. Enter the copied test device ID in DEVICE_ID.

 

func setTestDevice(testId: String) {
        Adiz.setTestDevice(testId)
}
- (void)setTestDevice: (NSString *)testId {
        [Adiz setTestDevice: testId];
}


Ad inspector usage

The Ad Inspector is an in-app overlay tool that analyzes the process of requesting and displaying actual ads on test devices in real-time. It informs you of the time taken to load ads and provides reasons for any failures in display. You can also specify a particular ad network to check if the ads are displayed correctly, and if there are issues, you can debug at the code level. All of this is done in conjunction with the Ad Inspector UI. It is included in Google Mobile Ads SDK version 7.68.0 and above for iOS and can be used by calling AdizDeveloperTool.OpenAdInspector.

 

To use the ad inspector, ad exposure on the test device must be set.

func openAdInspector(viewController: UIViewController) {
        AdizDeveloperTool.openAdInspector(viewController)
}
- (void)openAdInspector: (UIViewController *)viewController {
        [AdizDeveloperTool openAdInspector: viewController];
}

Adiz AppID settings

Set the Adiz AppID that you registered in the Hive console AppCenter. If not set, the Bundle ID will be used.

Adiz.setAppId(appId)
[Adiz setAppId: appId];

Hive Console server configuration

Setting up the Hive console server to use. The default is real. Even if you use the production server, enabling test mode will only display test ads.

  • Hive Test Console Server: AdizZoneType.test
  • Hive Sandbox Console Server: AdizZoneType.sandbox
  • Hive Production Console Server: AdizZoneType.real
Adiz.setZone(AdizZoneType.real)
[Adiz setZone: AdizZoneTypeReal];

User-specific ad exposure

With the introduction of ATT (App Tracking Transparency) in iOS 14.5+, privacy has been strengthened. Accordingly, user-specific ads can only be displayed if the user agrees to activity tracking in the ATT consent popup. To maximize ad revenue by displaying user-specific ads, you need to write an IDFA (Identifier for Advertisers) message.

Write and publish the IDFA message on the Google AdMob dashboard as shown below.

You can refer to the guide below when writing an IDFA message.

The example of the posted message is as follows.

After writing and posting the IDFA message, set the user tracking access permissions. Follow the steps below to add a key to Info.plist.

  1. Select your project in the project navigator of the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click on the Info tab.
  4. Click on the Custom iOS Target Properties item in the Info tab.
  5. Right-click in the Custom iOS Target Properties list.
  6. Click on the Add Row menu.
  7. Enter NSUserTrackingUsageDescription in the Key field, and add the value specified in Localization file > Base.Iproj folder > InfoPlist.strings in the Value field.

 

Next, write a message requesting permission approval from app users specified in the multilingual configuration file (General Settings > Access Permission Request Settings). If you do not enter a permission approval request popup message, the additional explanatory guide regarding the user access permissions in use will be missing, leading to rejection during app review.

 

If you have completed up to this point, the ATT consent popup will be automatically displayed during Adiz initialization. When the user clicks "Allow" on the ATT consent popup, IDFA will be activated, and personalized ads will be displayed.

If the game targets Europe and the UK (EEA & UK), a GDPR (General Data Protection Regulation) consent popup must be displayed. The GDPR consent popup will only be shown if the user's device IP address is from Europe and the UK (EEA & UK). Adiz supports the display of the GDPR consent popup through Google UMP (User Messaging Platform). After creating the GDPR message in the AdMob console, initialize Adiz to display the GDPR popup to users accessing from Europe and the UK.

Warning

When targeting regions outside of Europe and the UK, for example, if you are planning to provide services only domestically, you can skip the GDPR consent popup exposure (Europe, UK) step and proceed with initialization using the Adiz.initializeForNonGDPR() method.
If you proceed with initialization using the Adiz.initialize() method, you must create a GDPR message in the AdMob console for the Adiz initialization to proceed normally.

Warning

If you are using the Hive SDK, you must run AuthV4.setup after completing the initialization of Hive Adiz. If the GDPR consent screen appears after displaying the ATT (APP Tracking Transparency) consent notification, your app may be rejected during the Apple app review.

Writing GDPR Message

Access the Google AdMob console to write a GDPR message. Before writing the GDPR message, please refer to the GDPR Message Writing Guide.

When drafting a GDPR message, you must add the mediation you wish to use to the list of advertising partners.
Here’s how to add mediation.

1) Go to the Privacy & Messaging > European Regulations > Settings tab in the Google AdMob dashboard, then click the edit icon for 'Ad Partner Review > Custom Ad Partners. 2) Check all mediation partners certified by Google under GDPR to add them in bulk, or select only the desired mediation partners and click Add.

If you have written a GDPR message, the GDPR consent popup will automatically appear when Adiz is initialized.

Implementation of GDPR Consent/Withdrawal Function

The items in the GDPR consent popup must provide the user with the ability to modify their consent status at any time. For example, a user may not have initially consented to GDPR but may wish to consent again in order to view personalized advertisements, or conversely, a user may have initially consented to GDPR but may no longer wish to provide personal information and want to withdraw their consent. To address these situations, app developers must implement functionality that allows users to re-consent to each item or withdraw their existing consent. To implement the GDPR consent/withdrawal function, follow these steps.

  1. Implement a button UI in the app that can reopen the GDPR consent popup.
  2. When implementing Adiz initialization, call isPrivacyOptionsRequired() to display the button UI to users accessing from Europe and the UK, and not display it otherwise. If a user accessing from Europe or the UK clicks the button, call showPrivacyOptionsForm to reopen the GDPR consent popup. This allows the user to modify their consent for GDPR details at any time by pressing a button like "Manage Options" in the app. The showPrivacyOptionsForm below is a method implemented arbitrarily for example purposes, and the developer can change the implementation as desired.
import HiveAdiz

func initialize(_ appId: String) {
        // ...
        // isPrivacyOptionsRequired is default false
        targetViewController.showPrivacyFormButton.isEnabled = AdizConsentManager.isPrivacyOptionsRequired() 

        // HiveAdiz initialize
        Adiz.initialize(targetViewController) { error, json in
                // ...
                // showPrivacyOptionsForm button enable check
                targetViewController.showPrivacyFormButton.isEnabled = AdizConsentManager.isPrivacyOptionsRequired()
                // ...
        }
} 

func showPrivacyOptionsForm(_ targetViewController: UIViewController) {
        // Show GDPR Form
        if AdizConsentManager.isPrivacyOptionsRequired() {
        AdizConsentManager.showPrivacyOptionsForm(targetViewController) { error in
                        // No need to do any error handling.
                }
        }
}
        #import <HiveAdiz/HiveAdiz-Swift.h>

        - (void)initialize: (NSString *)appId {
                // ...
                // isPrivacyOptionsRequired is default false
                targetViewController.showPrivacyFormButton.enabled = [AdizGDPRManager isPrivacyOptionsRequired];

                // HiveAdiz initialize   
                [Adiz initialize: targetViewController handler:^(AdizError * error, NSDictionary<NSString *,id> * json) {
                        // ...
                        // showPrivacyOptionsForm button enable check
                        targetViewController.showPrivacyFormButton.enabled = [AdizConsentManager isPrivacyOptionsRequired];
                        // ...
                }];
        }

        - (void)showPrivacyOptionsForm: (UIViewController*) targetViewController {
                // Show GDPR Form
                if ([AdizConsentManager isPrivacyOptionsRequired]) {
                        [AdizConsentManager showPrivacyOptionsForm: targetViewController handler:^(AdizError *error) {
                                // No need to do any error handling.
                        }];
                }
        }

Setting Tags for Users Under GDPR Consent Age (TFUA)

You can use the Tag For Under the Age of Consent (TFUA) to treat users residing in the European Economic Area (EEA), the UK, and Switzerland as subjects of limited data processing when making advertising requests. For apps targeting children, you can set the user as under the age of consent using AdizConsentManager.SetUserPrivacySettings. While there are some differences among European countries, GDPR defines the age requiring parental consent as under 16 years old. The underage consent setting must be configured before executing Adiz.initialize.

Warning

Setting both the GDPR consent age tag setTagForUnderAgeOfConsent and the COPPA children-targeted setting setTagForChildDirectedTreatment to true at the same time will result in the COPPA children-targeted setting setTagForChildDirectedTreatment taking precedence. Therefore, do not set both to true and use them simultaneously.

Note

Hive SDK v4 24.2.0 or higher, when used together with Adiz 2.0.1 or higher, the consent age setting from Hive SDK will automatically apply to users under the consent age.

However, if the user directly calls the AdizConsentManager.setUserPrivacySettings API before executing Adiz.initialize, the consent age settings defined by the Hive SDK will not apply, and the values set during the AdizConsentManager.setUserPrivacySettings API call will take precedence.

 

func initialize(_ appId: String) {
    bool isTagForUnderAgeOfConsent = false // Change to true if underage


    let privacySet = PrivacySettings.Builder()
        .setTagForUnderAgeOfConsent(isTagForUnderAgeOfConsent)

    AdizConsentManager.setUserPrivacySettings(privacySet.build())

    // HiveAdiz 초기화
    Adiz.initialize(targetViewController) { error, json in
        // ...
    }
}
- (void)initialize: (NSString *)appId {
    bool isTagForUnderAgeOfConsent = false; // Change to true if underage


    PrivacySettingsBuilder* privacySet = [[PrivacySettingsBuilder alloc] init];
    privacySet = [builder setTagForUnderAgeOfConsent: isTagForUnderAgeOfConsent];

    [AdizConsentManager setUserPrivacySettings: [privacySet build]];

    // HiveAdiz initialize
    [Adiz initialize: targetViewController handler:^(AdizError * error, NSDictionary<NSString *,id> * json) {
        // ...
    }];
}

GDPR Test Device Setup

The GDPR consent popup will only be displayed if the device's IP address is from Europe or the UK. During the development phase, the GDPR consent popup can be forcibly displayed regardless of the IP address to test the popup display, and to do this, you need to set up a GDPR test device. Please follow the steps below to set up the GDPR test device.

  1. Initialize Adiz by initializing. This is an initialization to check the test device ID, and there is no need to write a GDPR consent message.
  2. Check the debug log for a message that confirms the device ID. The message below is an example.

    To enable debug mode for this device, set: UMPDebugSettings.testDeviceIdentifiers = @[B74F6468-1516-467C-99AD-CC5973C5DB52]

    Check the device ID in the message (example: B74F6468-1516-467C-99AD-CC5973C5DB52).

  3. Copy the device ID.
  4. Add Adiz.setTestDevice(DEVICE_ID) before executing Adiz.initialize in the existing Adiz initialization code.
  5. Write the GDPR consent message and reinitialize Adiz to ensure the GDPR consent popup appears correctly.
func initialize(_ appId: String) {
    // ...
    // Set TestDevice before Adiz.initialize. example @"B74F6468-1516-467C-99AD-CC5973C5DB52"
    Adiz.setTestDevice("B74F6468-1516-467C-99AD-CC5973C5DB52")

    // HiveAdiz initialize
    Adiz.initialize(targetViewController) { error, json in
            // ...
    }
}
- (void)initialize: (NSString *)appId {
    // ...
    // Set TestDevice before Adiz.initialize. example @"B74F6468-1516-467C-99AD-CC5973C5DB52"
    [Adiz setTestDevice: @"B74F6468-1516-467C-99AD-CC5973C5DB52"];

    // HiveAdiz 초기화
    [Adiz initialize: targetViewController handler:^(AdizError * error, NSDictionary<NSString *,id> * json) {
            // ...
    }];
}

COPPA child-directed treatment tag setting

According to the Children's Online Privacy Protection Act (COPPA), app developers can specify whether Google should treat content as child-directed by using the child-directed treatment tag setting (tagForChildDirectedTreatment, TFCD) when making ad requests. If you want it to be treated as child-directed, you must call AdizConsentManager.SetUserPrivacySettings before executing Adiz.initialize. When using Adiz with the Hive SDK, the child-directed treatment tag is automatically applied, so no additional settings are required.

func initialize(_ appId: String) {
        bool isTagForChildDirectedTreatment = false // Change to true if it's for children

        let privacySet = PrivacySettings.Builder()
                .setTagForChildDirectedTreatment(isTagForUnderAgeOfConsent)

        AdizConsentManager.setUserPrivacySettings(privacySet.build())

        // HiveAdiz initialize
        Adiz.initialize(targetViewController) { error, json in
                // ...
        }
}
    (void)initialize: (NSString *)appId {
        bool isTagForChildDirectedTreatment = false; // Change to true if it is for children 

        PrivacySettingsBuilder* privacySet = [[PrivacySettingsBuilder alloc] init];
        privacySet = [builder setTagForChildDirectedTreatment: isTagForChildDirectedTreatment];

        [AdizConsentManager setUserPrivacySettings: [privacySet build]];

        // HiveAdiz initialize
        [Adiz initialize: targetViewController handler:^(AdizError * error, NSDictionary<NSString *,id> * json) {
                // ...
        }];
}

Add mediation

Adiz can display ads using AdMob mediation. To add AdMob mediation, follow the steps below.

Adding AdMob mediation

We will proceed with the integration of the ad source in the AdMob console. Follow the table below to proceed.

AppLovin Liftoff Monetize Meta Audience Network Pangle Unity Ads ironSource
Step 1 Set up AppLovin configuration Set up Liftoff Monetize configuration Set up Meta Audience Network configuration Set up Pangle configuration Set up Unity Ads configuration Set up ironSource configuration
Step 2 Add AppLovin ad source to AdMob Add Liftoff Monetize ad source to AdMob Add Meta Audience Network ad source to AdMob Add Pangle ad source to AdMob Add Unity Ads ad source to AdMob Add ironSource ad source to AdMob
Step 3 Add Adiz adapter
Step 4 Add AppLovin SKAdNetwork Add Liftoff SKAdNetwork Add Meta Audience Network SKAdNetwork Add Pangle SKAdNetwork Add Unity Ads SKAdNetwork Add ironSource SKAdNetwork

Adding Adiz adapter

Add dependencies to the CocoaPods Podfile.

# ...

$HIVE_ADIZ_VERSION = '2.1.3'

def adiz
  pod 'HiveAdiz', $HIVE_ADIZ_VERSION
end

def adizAdapter
  pod 'HiveAdizAdapterAppLovin', $HIVE_ADIZ_VERSION
  pod 'HiveAdizAdapterLiftoff', $HIVE_ADIZ_VERSION
  pod 'HiveAdizAdapterMeta', $HIVE_ADIZ_VERSION
  pod 'HiveAdizAdapterPangle', $HIVE_ADIZ_VERSION
  pod 'HiveAdizAdapterUnityAds', $HIVE_ADIZ_VERSION
  pod 'HiveAdizAdapterIronSource', $HIVE_ADIZ_VERSION
end

target 'MyGame-mobile' do
  adiz
  adizAdapter
end

# ...

 

To verify that the Adiz adapter configuration has been applied correctly, run the app and check the configuration list on the Ad Inspector screen.

Adding SKAdNetwork

For iOS 14 and above, refer to the Update your info.plist guide to add the SKAdNetwork list to your Info.plist file.

The list of SKAdNetwork supported by each mediation is different and may contain duplicate values. Therefore, it is necessary to remove duplicate values from all advertising mediation SKAdNetwork settings currently supported by Adiz, as shown in the list below.

(Adiz 2.1.3 - as of 2025/01/21: 165)

<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cstr6suwn9.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4fzdc2evr5.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>2fnua5tdw4.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ydx93a7ass.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>p78axxw29g.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v72qych5uu.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ludvb6z3bs.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cp8zw746q7.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3sh42y64q3.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>c6k4g5qg8m.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>s39g8k73mm.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3qy4746246.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>hs6bdukanm.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>mlmmfzh3r3.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v4nxqhlyqp.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>wzmmz9fp6w.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>su67r6k2v3.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>yclnxrl5pm.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>7ug5zh24hu.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>gta9lk7p23.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>vutu7akeur.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>y5ghdn5j9k.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v9wttpbfk9.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>n38lu8286q.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>47vhws6wlr.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>kbd757ywx3.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9t245vhmpl.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>a2p9lx4jpn.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>22mmun2rn5.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4468km3ulz.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>2u9pt9hc89.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>8s468mfl3y.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ppxm28t8ap.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>uw77j35x4d.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>pwa73g5rt2.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>578prtvx9j.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4dzt52r2t5.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>tl55sbb4fm.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>e5fvkxwrpn.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>8c4e2ghe7u.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3rd42ekr43.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3qcr597p9d.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>238da6jt44.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>24t9a8vw3c.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>24zw6aqk47.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>252b5q8x7y.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>275upjj5gd.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>294l99pt4k.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>32z4fx6l9h.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3l6bd9hu43.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>424m5254lk.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>44jx6755aq.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>44n7hlldy6.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>488r3q3dtq.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4mn522wn87.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4pfyvq9l8r.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4w7y6s5ca2.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>523jb4fst2.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>52fl2v3hgk.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>54nzkqm89y.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>5a6flpkh64.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>5l3tpt7t6e.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>5lm9lj6jb7.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>5tjdwbrq8w.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>6964rsfnh4.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>6g9af3uyq4.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>6p4ks3rnbw.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>6v7lgmsu45.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>6xzpu9s2p8.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>737z793b9f.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>74b6s63p6l.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>79pbpufp6p.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>7fmhfwg9en.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>7rz58n8ntl.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>84993kbrcf.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>89z7zv988g.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>8m87ys6875.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>8r8llnkz5a.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>97r2b46745.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9b89h5y424.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9nlqeag3gk.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9rd848q2bz.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9vvzujtq5s.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9yg77x724h.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>a7xqa6mtl2.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>a8cz6cu7e5.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>av6w8kgt66.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>b9bk5wbcq9.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>bxvub5ada5.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>c3frkrj4fj.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cg4yq2srnc.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cj5566h2ga.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cs644xg564.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cwn433xbcr.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>dbu4b84rxf.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>dkc879ngq3.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>dzg6xy7pwj.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ecpz2srf59.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>eh6m2bh4zr.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ejvt5qm6ak.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>f38h382jlk.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>f73kdq92p3.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>f7s53z58qe.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>feyaarzu9v.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>g28c52eehv.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>g2y4y55b64.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>g6gcrrvk4p.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ggvn48r87g.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>glqzh8vgby.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>gta8lk7p23.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>hb56zgv37p.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>hdw39hrw9y.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>k674qkevps.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>kbmxgpxpgc.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>klf5c3l5u5.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>krvm3zuq6h.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>lr83yxwka7.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>m297p6643m.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>m5mvw97r93.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>m8dbw4sv7c.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>mls7yz5dvl.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>mp6xlyr22a.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>mqn7fxpca7.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>mtkv5xtk9e.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>n66cz3y3bx.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>n6fk4nfna4.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>n9x2a789qt.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>nzq8sh4pbs.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>prcb7njmu6.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>pwdxu55a5a.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>qqp299437r.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>qu637u8glc.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>r45fhb6rf7.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>rvh3l7un93.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>rx5hdcabgc.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>s69wq72ugq.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>t38b2kh725.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>u679fj5vs4.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v79kvwwj4g.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>vcra2ehyfk.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>vhf287vqwu.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>w9q455wk68.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>wg4vff78zm.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>x44k69ngh6.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>x5l83yy675.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>x8jxxk4ff5.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>x8uqf25wch.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>xga6mpmplv.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>xy9t38ct57.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>y45688jllp.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>z24wtl6j62.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>zmvfpc5aq8.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>zq492l623r.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>k6y4y55b64.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>6yxyv74ff7.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>mj797d8u6f.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>5f5u5tfb26.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>apzhy3va96.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>t6d3zquu66.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>zmmz9fp6w.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ns5j362hk7.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9g2aggbj52.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>r26jy69rpl.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>nu4557a4je.skadnetwork</string>
</dict>
<dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cdkw7geqsh.skadnetwork</string>
</dict>

Adiz initialization

This is a mandatory step that must be performed before displaying ads of all types. By initializing Adiz, you will receive the ad key necessary for displaying ads. If you have activated test mode, you will receive a test key.

Warning

If you are using GDPR settings, you must run AuthV4.setup after completing the Hive Adiz initialization. If the GDPR consent screen appears after displaying the ATT (App Tracking Transparency) consent notification, the app may be rejected during Apple's app review.

import HiveAdiz

// Hive Adiz 초기화
Adiz.initialize(targetViewController) { error, json in
        if error.isSuccess,
                let responseList = json?["keys"] as? [[String:Any]] {

                var interstitialKeyList = [String]()
                var bannerKeyList = [String]()
                var nativeKeyList = [String]()
                var rewardedKeyList = [String]()
                var rewardedInterstitialKeyList = [String]()
                var appOpenKeyList = [String]()

                for response in responseList {
                        if let isDefault = response["is_default"] as? Bool,
                                isDefault == false {
                                let hiveAdKey = response["key"] as? String ?? ""
                                let hiveForm = response["form"] as? String ?? ""

                                switch hiveForm {
                                case "interstitial": interstitialKeyList.append(hiveAdKey)
                                case "banner": bannerKeyList.append(hiveAdKey)
                                case "native": nativeKeyList.append(hiveAdKey)
                                case "rewarded": rewardedKeyList.append(hiveAdKey)
                                case "rewarded_interstitial": rewardedInterstitialKeyList.append(hiveAdKey)
                                case "app_open": appOpenKeyList.append(hiveAdKey)
                                default: break
                                }
                        }
                }

                print("interstitialKeyList \(interstitialKeyList)");
                print("bannerKeyList \(bannerKeyList)");
                print("nativeKeyList \(nativeKeyList)");
                print("rewardedKeyList \(rewardedKeyList)");
                print("rewardedInterstitialKeyList \(rewardedInterstitialKeyList)");
                print("appOpenKeyList \(appOpenKeyList)");
        }
}
#import <HiveAdiz/HiveAdiz-Swift.h>

// Initializing Hive Adiz
[Adiz initialize: targetViewController handler:^(AdizError * error, NSDictionary<NSString *,id> * json) {
        if([error isSuccess] && json[@"keys"] != nil) {
                NSArray* responseList = json[@"keys"];

                NSMutableArray<NSString*> *interstitialKeyList = [[NSMutableArray alloc] init];
                NSMutableArray<NSString*> *bannerKeyList = [[NSMutableArray alloc] init];
                NSMutableArray<NSString*> *nativeKeyList = [[NSMutableArray alloc] init];
                NSMutableArray<NSString*> *rewardedKeyList = [[NSMutableArray alloc] init];
                NSMutableArray<NSString*> *rewardedInterstitialKeyList = [[NSMutableArray alloc] init];
                NSMutableArray<NSString*> *appOpenKeyList = [[NSMutableArray alloc] init];

                for (NSDictionary* response in responseList) {
                        // This is an example of setting up the list of ad keys (is_default = false) when you wants to put the ad key directly.
                        if (response[@"is_default"] != nil && [response[@"is_default"] boolValue] == false) {
                                NSString* hiveAdKey = response[@"key"];
                                NSString* hiveForm = response[@"form"];
                                if ([hiveForm isEqualToString: @"interstitial"]) {
                                        [interstitialKeyList addObject: hiveAdKey];
                                } else if ([hiveForm isEqualToString: @"banner"]) {
                                        [bannerKeyList addObject: hiveAdKey];
                                } else if ([hiveForm isEqualToString: @"native"]) {
                                        [nativeKeyList addObject: hiveAdKey];
                                } else if ([hiveForm isEqualToString: @"rewarded"]) {
                                        [rewardedKeyList addObject: hiveAdKey];
                                } else if ([hiveForm isEqualToString: @"rewarded_interstitial"]) {
                                        [rewardedInterstitialKeyList addObject: hiveAdKey];
                                } else if ([hiveForm isEqualToString: @"app_open"]) {
                                        [appOpenKeyList addObject: hiveAdKey];
                                }
                        }
                }

                NSLog(@"interstitialKeyList %@", interstitialKeyList);
                NSLog(@"bannerKeyList %@", bannerKeyList);
                NSLog(@"nativeKeyList %@", nativeKeyList);
                NSLog(@"rewardedKeyList %@", rewardedKeyList);
                NSLog(@"rewardedInterstitialKeyList %@", rewardedInterstitialKeyList);
                NSLog(@"appOpenKeyList %@", appOpenKeyList);
        }
}];

 

The JSON file received as a callback during initialization contains a list of advertisement keys. The list of advertisement keys has the following format.

    {
            "keys":[
                    {
                            "mediation_id":5,
                            "key":"ca-app-pub-3940256099942544/5354046379",
                            "form":"rewarded_interstitial",
                            "is_default":true,
            "placement_id":"lobby01"
                    },
                    {
                            "mediation_id":4,
                            "key":"ca-app-pub-3940256099942544/5224354917",
                            "form":"rewarded",
                            "is_default":true,
            "placement_id":"game02"
                    },
                    {
                            "mediation_id":3,
                            "key":"ca-app-pub-3940256099942544/2247696110",
                            "form":"native",
                            "is_default":true,
            "placement_id":"event01"
                    },
                    {
                            "mediation_id":1,
                            "key":"ca-app-pub-3940256099942544/1033173712",
                            "form":"interstitial",
                            "is_default":true,
            "placement_id":"mission01"
                    },
                    {
                            "mediation_id":2,
                            "key":"ca-app-pub-3940256099942544/6300978111",
                            "form":"banner",
                            "is_default":true,
            "placement_id":"main01"
                    },
                    {
                            "mediation_id":6,
                            "key":"ca-app-pub-3940256099942544/9257395921",
                            "form":"app_open",
                            "is_default":true,
            "placement_id":"appopen01"
                    }
            ]
    }

 

When initializing in test mode, you will receive a list of test ad keys even if you have not registered the AdMob ad keys in the console. When initializing in production mode, you will receive the list of AdMob ad keys registered in the console.

For each type of advertisement (form), one advertisement is used as the default advertisement (the advertisement with "is_default":true). When an advertisement type is first registered, the initially registered advertisement becomes the default advertisement. The default advertisement does not require the advertisement key (hiveAdKey) to be entered when creating an advertisement instance (initialize()). To change the default advertisement, you must delete the existing default advertisement from the console and register a new advertisement.

Setting up ad callback listener

By implementing AdizListener when creating each ad instance, you can receive callbacks based on changes in the ad status.

Name Description Required Implementation
onLoad() Ad load successful O
onFail(error: AdizError) Failure (the reason for failure can be known by error.getCode() and error.getMessage()) O
onShow() Ad display success O
onClick() Ad Click O
onPaidEvent(_ revenueData: AdRevenueData) The point at which a paid event is received after ad exposure, and ad revenue information is conveyed O
onClose() Ad End
  • To re-display the same ad instance after the ad has ended, you must call load() again and then call show().
  • To stop displaying the ad, call destroy() to remove the ad instance.
X
onRewarded(_ rewardItem: RewardItem) The point at which the user receives a reward after the ad exposure in reward-based ads (rewarded, rewarded interstitial) X
import HiveAdiz

class TestAdizListener: AdizListener {
        func onLoad() {
                // Called when the ad is loaded.
                // If the ad load is successful, you need to call the ad instance's .show() at the desired point to display the ad.
                print("[\(delegateTypeName)] onLoad")
        }
        func onFail(_ error: AdizError) {
                // Called if the ad load failed or the ad display failed for some other reason.
                print("[\(delegateTypeName)] onFail: ")
                print("(\(error.getCode())) \(error.getMessage() ?? "")")
        }
        func onShow() {
                // Called when the ad is displayed.
                print("[\(delegateTypeName)] onShow")
        }
        func onClick() {
                // Called when the ad is clicked.
                print("[\(delegateTypeName)] onClick")
        }
        func onPaidEvent(_ revenueData: AdRevenueData) {
                // Called when the revenue for the ad is generated.
                print("[\(delegateTypeName)] onPaidEvent: \(revenueData.getCurrency()) \(revenueData.getRevenue().description)")
                var revenue = revenueData.getRevenue() // revenue when ad is exposed
                var currency = revenueData.getCurrency() // currency code for revenue when ad is exposed
        }
        func onClose() {
                // Called when the ad is closed.
                // Banner, Native ads do not have an onClose callback.
                print("[\(delegateTypeName)] onClose")
        }
        func onRewarded(_ rewardItem: RewardItem) {
                // Called when a reward occurs for watching the ad in rewarded, rewarded interstitial ads.
                print("[\(delegateTypeName)] onRewarded")
                print("amount: \(rewardItem.getItemAmount()) type: \(rewardItem.getItemType())")

                var itemType = rewardItem.getItemType() // Reward item type
                var itemAmount = rewardItem.getItemAmount() // Reward item quantity    }}
#import <HiveAdiz/HiveAdiz-Swift.h>

@interface TestAdizListener : NSObject<AdizListener>
@end

@implementation TestAdizListener

- (void) onLoad {
        // Called when the ad is loaded.
        // If the ad load is successful, you need to call the ad instance's .show() at the desired point to display the ad.
        NSLog(@"[TestAdizListener] onLoad");
}

- (void) onFail:(AdizError *)error {
        // Called if the ad load failed or the ad display failed for some other reason.
        NSLog(@"[TestAdizListener] onFail: ");
        NSLog(@"errorCode: %ld, errorMessage: %@", (long)[error getCode], [error getMessage]);
}

- (void) onShow {
        // Called when the ad is displayed.
        NSLog(@"[TestAdizListener] onShow");
}

- (void) onClick {
        // Called when the ad is clicked.
        NSLog(@"[TestAdizListener] onClick");
}

- (void) onPaidEvent:(AdRevenueData *)revenueData {
        // Called when the revenue for the ad is generated.
        NSLog(@"[TestAdizListener] onPaidEvent: %@ %f", [revenueData getCurrency], [revenueData getRevenue]);
        double revenue = [revenueData getRevenue]; // revenue when ad is exposed
        NSString* currency = [revenueData getCurrency]; // currency code for revenue when ad is exposed
}

- (void) onClose {
        // Called when the ad is closed.
        // Banner, Native ads do not have an onClose callback.
        NSLog(@"[TestAdizListener] onClose");
}

- (void) onRewarded:(RewardItem *)rewardItem {
        // Called when a reward occurs for watching the ad in rewarded, rewarded interstitial ads.
        NSLog(@"[TestAdizListener] onRewarded");
        NSLog(@"amount: %ld type: %@", (long)[rewardItem getItemAmount], [rewardItem getItemType]);

        NSString* itemType = [rewardItem getItemType]; // Reward item type
        NSInteger itemAmount = [rewardItem getItemAmount]; // Reward item type quantity
}

@end

Error Codes

When receiving onFail() in Adiz.Initialize and AdizListener, the AdizError error code and error message are as follows.

Common Code

Number Case Explanation
0 Success Success

Adiz Error Codes

Number Case Explanation
-1 InvalidParam Invalid parameter
-2 NotSupported Not supported
-3 InProgress Process in progress
-4 Network Network error
-5 NeedInitialize Initialization required
-6 ResponseFail Response failed
-7 Timeout Network timeout
-99 Unknown Unknown error

Ad Platform Error Codes

Number Case Explanation
-101 NeedLoad Ad did not load
-102 NeedReload Need to reload due to ad exposure time expiration
-103 NotEnoughInventory Mediation response was successful, but no ads were filled due to lack of inventory
-104 MissingAppId AppID error for mediation request
-105 InternalNetworkError Mediation network-related error
-106 InvalidUnitId Invalid Unit Id
-107 MediationNoFill Mediation adapter failed to process ad request
-108 AlreadyLoaded Already in a loaded state
-109 CannotRequestAds Cannot request ads
-201 GdprConsentError GDPR consent error
-202 IsNotPrivacyOptionsRequired Cannot display GDPR consent popup or it is in a state where it does not need to be displayed

Ad display and ad termination

To display and terminate ads, follow the steps below.

  1. Create an ad instance in the ad class for each type of ad you want to display. If the ad you want to display is not a default ad, you need to enter the ad key or placement ID obtained from initialization. If you do not enter the ad key (hiveAdKey) or placement ID (placementId), a default ad instance will be created. The placement ID can be set in the Hive console, and for more details, please refer to the Admob settings page in the console guide.
  2. Load the ad you want to display (load()).
  3. Display the loaded ad (show()). To re-display the ad, you must call load() again and then call show().
  4. To close the ad, call destroy().

Interstitial ads

Full-screen ads that take up the entire screen.

import UIKit
import HiveAdiz

class InitViewController: UIViewController {

        // Create an interstitial ad instance.
        var interstitialAd: AdizInterstitial?

        func requestInitAd(hiveAdKey: String?) {
                if let adKey = hiveAdKey,
                        adKey.count > 0 {
                        // Initialize AdizInterstitial Instance (ViewController, hiveAdKey, AdizListener)
                        self.interstitialAd = AdizInterstitial.initialize(self, hiveAdKey: adKey, adizListener: self)
                }
                else {
                        // Initialize Default AdizInterstitial Instance (ViewController, AdizListener)
                        self.interstitialAd = AdizInterstitial.initialize(self, adizListener: self)
                }
        }

        func requestInitAdWithPlacementId(placementId: String?) {
                if let placementId = placementId,
                        placementId.count > 0 {
                        // Initialize AdizInterstitial Instance (ViewController, placementId, AdizListener)
                        self.interstitialAd = AdizInterstitial.initializeWithPlacementId(self, placementId: placementId, adizListener: self)
                }
                else {
                        // Initialize Default AdizInterstitial Instance (ViewController, AdizListener)
                        self.interstitialAd = AdizInterstitial.initialize(self, adizListener: self)
                }
        }

        func requestLoadAd() {
                // Load AdizInterstitial
                if let ad = self.interstitialAd,
                    ad.isInitialized() {
                        ad.load()
                        }
        }

        func requestShowAd() {
                // Show AdizInterstitial
                if let ad = self.interstitialAd,
                    ad.isLoaded() {
                        ad.show()
                        }
        }

        func requestDestroyAd() {
                // Destroy AdizInterstitial
                self.interstitialAd?.destroy()
                self.interstitialAd = nil
        }
}

extension InitViewController: AdizListener {
        func onLoad() {
                // requestShowAd()
        }
        func onFail(_ error: AdizError) {
        }
        func onShow() {
        }
        func onClick() {
        }
        func onPaidEvent(_ revenueData: AdRevenueData) {
        }
        func onClose() {
                // requestDestroyAd()
        }
}
#import <UIKit/UIKit.h>
#import <HiveAdiz/HiveAdiz-Swift.h>

@interface InitViewController : UIViewController<AdizListener>
@property (nonatomic, strong) AdizInterstitial* interstitialAd;
@end

@implementation InitViewController

- (void) requestInitAd: (NSString*)hiveAdKey {
        if (hiveAdKey != nil && ![hiveAdKey isEqualToString:@""]) {
                // Initialize AdizInterstitial Instance (ViewController, hiveAdKey, AdizListener)
                // Create an interstitial ad instance.
                self.interstitialAd = [AdizInterstitial initialize:self hiveAdKey:hiveAdKey adizListener:self];
        }
        else {
                // Initialize Default AdizInterstitial Instance (ViewController, AdizListener)
                self.interstitialAd = [AdizInterstitial initialize:self adizListener:self];
        }
}

- (void) requestInitAdWithPlacementId: (NSString*)placementId {
        if (placementId != nil && ![placementId isEqualToString:@""]) {
                // Initialize AdizInterstitial Instance (ViewController, placementId, AdizListener)
                // Create an interstitial ad instance.
                self.interstitialAd = [AdizInterstitial initializeWithPlacementId:self placementId:placementId adizListener:self];
        }
        else {
                // Initialize Default AdizInterstitial Instance (ViewController, AdizListener)
                self.interstitialAd = [AdizInterstitial initialize:self adizListener:self];
        }
}

- (void) requestLoadAd {
        // Load AdizInterstitial
        if (self.interstitialAd != nil && [self.interstitialAd isInitialized]) {
                [self.interstitialAd load];
        }
}

- (void) requestShowAd {
        // Show AdizInterstitial
        if (self.interstitialAd != nil && [self.interstitialAd isLoaded]) {
                [self.interstitialAd show];
        }
}

- (void) requestDestroyAd {
        // Destroy AdizInterstitial
        if (self.interstitialAd != nil) {
                [self.interstitialAd destroy];
                self.interstitialAd = nil;
        }
}

#pragma mark - AdizListener

- (void) onLoad {
        // [self requestShowAd];
}

- (void) onFail:(AdizError *)error {
}

- (void) onShow {
}

- (void) onClick {
}

- (void) onPaidEvent:(AdRevenueData *)revenueData {
}

- (void) onClose {
        // [self requestDestroyAd];
}

@end

This is a banner advertisement that displays a banner of a specific size. The banner advertisement does not receive the onClose() callback. Therefore, you need to call destroy() from another location to terminate the advertisement.

 

BannerSize follows the standard banner size.

Size Point (Width x Height) Description Supported Devices BannerSize Constant
320x50 Banner Mobile Phones and Tablets BannerSize.normal
320x100 Large Banner Mobile Phones and Tablets BannerSize.medium
300x250 IAB Medium Rectangle Mobile Phones and Tablets BannerSize.large
468 x 60 IAB Full-Size Banner Tablets BannerSize.full

 

PositionType is either the topmost or the bottommost. The default value is the bottommost.

Alignment Description PositionType Constant
Top Alignment Specifies top alignment based on SafeArea PositionType.top
Bottom Alignment (Default) Specifies bottom alignment based on SafeArea PositionType.bottom
import UIKit
import HiveAdiz

class BannerViewController: UIViewController {

        // Create AdizBanner Instance
        // Create an banner ad instance.
        var bannerAd: AdizBanner?

        func requestInitAd(hiveAdKey: String?) {        // Set banner size
                var bannerSize: BannerSize = .normal

                if let adKey = hiveAdKey,
                        adKey.count > 0 {
                        // Initialize AdizBanner Instance (ViewController, hiveAdKey, BannerSize, AdizListener)
                        self.bannerAd = AdizBanner.initialize(self, hiveAdKey: adKey, size: bannerSize, adizListener: self)
                }
                else {
                        // Initialize Default AdizBanner Instance (ViewController, BannerSize, AdizListener)
                        self.bannerAd = AdizBanner.initialize(self, size: bannerSize, adizListener: self)
                }    
        }    

        func requestInitAdWithPlacementId(placementId: String?) {        // Set banner size
                var bannerSize: BannerSize = .normal

                if let placementId = placementId,
                        placementId.count > 0 {
                        // Initialize AdizBanner Instance (ViewController, placementId, BannerSize, AdizListener)
                        self.bannerAd = AdizBanner.initializeWithPlacementId(self, placementId: placementId, size: bannerSize, adizListener: self)
                }
                else {
                        // Initialize Default AdizBanner Instance (ViewController, BannerSize, AdizListener)
                        self.bannerAd = AdizBanner.initialize(self, size: bannerSize, adizListener: self)
                }    
        }    

        func requestLoadAd() {
                // Load AdizBanner
                if let ad = self.bannerAd,
                    ad.isInitialized() {
                        ad.load()
                        }
        }     

        func requestShowAd() {
                // Set position type
                var position: PositionType = .top

                // Show AdizBanner
                if let ad = self.bannerAd,
                    ad.isLoaded() {
                        ad.show(position)
                        }
        }     

        func requestDestroyAd() {
                // Destroy AdizBanner
                self.bannerAd?.destroy()
                self.bannerAd = nil
        }
} 

extension BannerViewController: AdizListener {
        func onLoad() {
                // requestShowAd()
        }    
        func onFail(_ error: AdizError) {
        }    
        func onShow() {
        }    
        func onClick() {
        }    
        func onPaidEvent(_ revenueData: AdRevenueData) {    
        }
}
#import <UIKit/UIKit.h>
#import <HiveAdiz/HiveAdiz-Swift.h>

@interface BannerViewController : UIViewController<AdizListener>
@property (nonatomic, strong) AdizBanner* bannerAd;
@end

@implementation BannerViewController

- (void) requestInitAd: (NSString*)hiveAdKey {
        // Set banner size
        BannerSize bannerSize = BannerSizeNormal;

        if (hiveAdKey != nil && ![hiveAdKey isEqualToString:@""]) {
                // Initialize AdizBanner Instance (ViewController, hiveAdKey, BannerSize, AdizListener)
                self.bannerAd = [AdizBanner initialize:self hiveAdKey:hiveAdKey size: bannerSize adizListener:self];
        }    else {
                // Initialize Default AdizBanner Instance (ViewController, BannerSize, AdizListener)
                self.bannerAd = [AdizBanner initialize:self size:bannerSize adizListener:self];
        }
} 

- (void) requestInitAdWithPlacementId: (NSString*)placementId {
        // Set banner size
        BannerSize bannerSize = BannerSizeNormal;

        if (placementId != nil && ![placementId isEqualToString:@""]) {
                // Initialize AdizBanner Instance (ViewController, placementId, BannerSize, AdizListener)
                self.bannerAd = [AdizBanner initializeWithPlacementId:self placementId:placementId size: bannerSize adizListener:self];
        }    else {
                // Initialize Default AdizBanner Instance (ViewController, BannerSize, AdizListener)
                self.bannerAd = [AdizBanner initialize:self size:bannerSize adizListener:self];
        }
} 

- (void) requestLoadAd {
        // Load AdizBanner
        if (self.bannerAd != nil && [self.bannerAd isInitialized]) {
                [self.bannerAd load];
        }
} 

- (void) requestShowAd {
        // Set position type
        PositionType position = PositionTypeTop;

        // Show AdizBanner
        if (self.bannerAd != nil && [self.bannerAd isLoaded]) {
                [self.bannerAd show: position];
        }
} 

- (void) requestDestroyAd {
        // Destroy AdizBanner
        if (self.bannerAd != nil) {
                [self.bannerAd destroy];
                self.bannerAd = nil;
        }
} 

#pragma mark - AdizListener

- (void) onLoad {
        // [self requestShowAd];
} 

- (void) onFail:(AdizError *)error {
} 

- (void) onShow {
} 

- (void) onClick {
} 

- (void) onPaidEvent:(AdRevenueData *)revenueData {
} 

@end

Native advertising

This is a native advertisement that exposes a native template of a specific size. Native ads are optimized for vertical screens, so it is recommended to use them in vertical games (portrait mode games). Native ads do not receive the onClose() callback. Therefore, you need to call destroy() from another location to close the ad.

 

The current template supports small or medium sizes.

Size Point (Width x Height) Template Alignment BannerSize Constant
355x91 (Aspect Ratio Adjusted) Small Size Top / Bottom BannerSize.normal
355x370 (Aspect Ratio Adjusted) Medium Size Center (Fixed) BannerSize.medium, BannerSize.large, BannerSize.full

 

In the small template, PositionType is either top or bottom, with the default being bottom.

Alignment Description PositionType Constant
Top Alignment Specifies alignment at the top of the screen PositionType.top
Bottom Alignment (Default) Specifies alignment at the bottom of the screen PositionType.bottom

 

The medium template does not allow for alignment selection and uses center alignment by default.

import UIKit
import HiveAdiz

class NativeViewController: UIViewController {

        // Create AdizNative Instance
        var nativeAd: AdizNative?

        func requestInitAd(hiveAdKey: String?) {
                // Set banner size
                var bannerSize: BannerSize = .normal

                if let adKey = hiveAdKey,
                        adKey.count > 0 {
                        // Initialize AdizNative Instance (ViewController, hiveAdKey, BannerSize, AdizListener)
                        self.nativeAd = AdizNative.initialize(self, hiveAdKey: adKey, size: bannerSize, adizListener: self)
                }
                else {
                        // Initialize Default AdizNative Instance (ViewController, BannerSize, AdizListener)
                        self.nativeAd = AdizNative.initialize(self, size: bannerSize, adizListener: self)
                }
        }

        func requestInitAdWithPlacementId(placementId: String?) {
                // Set banner size
                var bannerSize: BannerSize = .normal

                if let placementId = placementId,
                        placementId.count > 0 {
                        // Initialize AdizNative Instance (ViewController, placementId, BannerSize, AdizListener)
                        self.nativeAd = AdizNative.initializeWithPlacementId(self, placementId: placementId, size: bannerSize, adizListener: self)
                }
                else {
                        // Initialize Default AdizNative Instance (ViewController, BannerSize, AdizListener)
                        self.nativeAd = AdizNative.initialize(self, size: bannerSize, adizListener: self)
                }
        }

        func requestLoadAd() {
                // Load AdizNative
                if let ad = self.nativeAd,
                    ad.isInitialized() {
                        ad.load()
                }
        }

        func requestShowAd() {
                // Set position type
                var position: PositionType = .top

                // Show AdizNative
                if let ad = self.nativeAd,
                    ad.isLoaded() {
                        ad.show(position)
                }
        }

        func requestDestroyAd() {
                // Destroy AdizNative
                self.nativeAd?.destroy()
                self.nativeAd = nil
        }
}

extension NativeViewController: AdizListener {
        func onLoad() {
                // requestShowAd()
        }
        func onFail(_ error: AdizError) {
        }
        func onShow() {
        }
        func onClick() {
        }
        func onPaidEvent(_ revenueData: AdRevenueData) {
        }
}
#import <UIKit/UIKit.h>
#import <HiveAdiz/HiveAdiz-Swift.h>

@interface NativeViewController : UIViewController<AdizListener>
@property (nonatomic, strong) AdizNative* nativeAd;
@end

@implementation NativeViewController

- (void) requestInitAd: (NSString*)hiveAdKey {
        // Set banner size
        BannerSize bannerSize = BannerSizeNormal;

        if (hiveAdKey != nil && ![hiveAdKey isEqualToString:@""]) {
                // Initialize AdizNative Instance (ViewController, hiveAdKey, BannerSize, AdizListener)
                self.nativeAd = [AdizNative initialize:self hiveAdKey:hiveAdKey size: bannerSize adizListener:self];
        }
        else {
                // Initialize Default AdizNative Instance (ViewController, BannerSize, AdizListener)
                self.nativeAd = [AdizNative initialize:self size:bannerSize adizListener:self];
        }
}

- (void) requestInitAdWithPlacementId: (NSString*)placementId {
        // Set banner size
        BannerSize bannerSize = BannerSizeNormal;

        if (placementId != nil && ![placementId isEqualToString:@""]) {
                // Initialize AdizNative Instance (ViewController, placementId, BannerSize, AdizListener)
                self.nativeAd = [AdizNative initializeWithPlacementId:self placementId:placementId size: bannerSize adizListener:self];
        }
        else {
                // Initialize Default AdizNative Instance (ViewController, BannerSize, AdizListener)
                self.nativeAd = [AdizNative initialize:self size:bannerSize adizListener:self];
        }
}

- (void) requestLoadAd {
        // Load AdizNative
        if (self.nativeAd != nil && [self.nativeAd isInitialized]) {
                [self.nativeAd load];
        }
}

- (void) requestShowAd {
        // Set position type
        PositionType position = PositionTypeTop;

        // Show AdizNative
        if (self.nativeAd != nil && [self.nativeAd isLoaded]) {
                [self.nativeAd show: position];
        }
}

- (void) requestDestroyAd {
        // Destroy AdizNative
        if (self.nativeAd != nil) {
                [self.nativeAd destroy];
                self.nativeAd = nil;
        }
}

#pragma mark - AdizListener

- (void) onLoad {
        // [self requestShowAd];
}

- (void) onFail:(AdizError *)error {
}

- (void) onShow {
}

- (void) onClick {
}

- (void) onPaidEvent:(AdRevenueData *)revenueData {
}

@end

Rewarded ads

This is a rewarded ad where users receive rewards for watching the ad for a certain period of time. Once the reward is granted, the reward item information is received through the onRewarded() callback.

import UIKit
import HiveAdiz  

class RewardViewController: UIViewController {

        // Create AdizRewarded Instance
        var rewardAd: AdizRewarded?

        func requestInitAd(hiveAdKey: String?) {
                if let adKey = hiveAdKey,
                        adKey.count > 0 {
                        // Initialize AdizRewarded Instance (ViewController, hiveAdKey, AdizListener)
                        self.rewardAd = AdizRewarded.initialize(self, hiveAdKey: adKey, adizListener: self)
                }
                else {
                        // Initialize Default AdizRewarded Instance (ViewController, AdizListener)
                        self.rewardAd = AdizRewarded.initialize(self, adizListener: self)
                }
        }

        func requestInitAdWithPlacementId(placementId: String?) {
                if let placementId = placementId,
                        placementId.count > 0 {
                        // Initialize AdizRewarded Instance (ViewController, placementId, AdizListener)
                        self.rewardAd = AdizRewarded.initializeWithPlacementId(self, placementId: placementId, adizListener: self)
                }
                else {
                        // Initialize Default AdizRewarded Instance (ViewController, AdizListener)
                        self.rewardAd = AdizRewarded.initialize(self, adizListener: self)
                }
        }

        func requestLoadAd() {
                // Load AdizRewarded
                if let ad = self.rewardAd,
                    ad.isInitialized() {
                        ad.load()
                }
        }

        func requestShowAd() {
                // Show AdizRewarded
                if let ad = self.rewardAd,
                    ad.isLoaded() {
                        ad.show()
                }
        }

        func requestDestroyAd() {
                // Destroy AdizRewarded
                self.rewardAd?.destroy()
                self.rewardAd = nil
        }
}

extension RewardViewController: AdizListener {
        func onLoad() {
                // requestShowAd()
        }
        func onFail(_ error: AdizError) {
        }
        func onShow() {
        }
        func onClick() {
        }
        func onPaidEvent(_ revenueData: AdRevenueData) {
        }
        func onClose() {
                // requestDestroyAd()
        }
        func onRewarded(_ rewardItem: RewardItem) {
        }
}
#import <UIKit/UIKit.h>
#import <HiveAdiz/HiveAdiz-Swift.h> 

@interface RewardedViewController : UIViewController<AdizListener>
@property (nonatomic, strong) AdizRewarded* rewardedAd;
@end

@implementation RewardedViewController

- (void) requestInitAd: (NSString*)hiveAdKey {
        if (hiveAdKey != nil && ![hiveAdKey isEqualToString:@""]) {
                // Initialize AdizRewarded Instance (ViewController, hiveAdKey, AdizListener)
                self.rewardedAd = [AdizRewarded initialize:self hiveAdKey:hiveAdKey adizListener:self];
        }
        else {
                // Initialize Default AdizRewarded Instance (ViewController, AdizListener)
                self.rewardedAd = [AdizRewarded initialize:self adizListener:self];
        }
}

- (void) requestInitAdWithPlacementId: (NSString*)placementId {
        if (placementId != nil && ![placementId isEqualToString:@""]) {
                // Initialize AdizRewarded Instance (ViewController, placementId, AdizListener)
                self.rewardedAd = [AdizRewarded initializeWithPlacementId:self placementId:placementId adizListener:self];
        }
        else {
                // Initialize Default AdizRewarded Instance (ViewController, AdizListener)
                self.rewardedAd = [AdizRewarded initialize:self adizListener:self];
        }
}

- (void) requestLoadAd {
        // Load AdizRewarded
        if (self.rewardedAd != nil && [self.rewardedAd isInitialized]) {
                [self.rewardedAd load];
        }
}

- (void) requestShowAd {
        // Show AdizRewarded
        if (self.rewardedAd != nil && [self.rewardedAd isLoaded]) {
                [self.rewardedAd show];
        }
}

- (void) requestDestroyAd {
        // Destroy AdizRewarded
        if (self.rewardedAd != nil) {
                [self.rewardedAd destroy];
                self.rewardedAd = nil;
        }
}

#pragma mark - AdizListener

- (void) onLoad {
        // [self requestShowAd];
}

- (void) onFail:(AdizError *)error {
}

- (void) onShow {
} 

- (void) onClick {
} 

- (void) onPaidEvent:(AdRevenueData *)revenueData {
}

- (void) onClose {
        // [self requestDestroyAd];
}

- (void) onRewarded:(RewardItem *)rewardItem {
}

@end

Rewarded interstitial ads

This is a rewarded interstitial ad where users receive rewards for watching the ad for a certain amount of time. Once the reward is granted, the reward item information is received through the onRewarded() callback.

import UIKit
import HiveAdiz  

class RewardInterstitialViewController: UIViewController {

        // Create AdizRewardedInterstitial Instance
        var rewardInterstitialAd: AdizRewardedInterstitial?

        func requestInitAd(hiveAdKey: String?) {
                if let adKey = hiveAdKey,
                        adKey.count > 0 {
                        // Initialize AdizRewardedInterstitial Instance (ViewController, hiveAdKey, AdizListener)
                        self.rewardInterstitialAd = AdizRewardedInterstitial.initialize(self, hiveAdKey: adKey, adizListener: self)
                }
                else {
                        // Initialize Default AdizRewardedInterstitial Instance (ViewController, AdizListener)
                        self.rewardInterstitialAd = AdizRewardedInterstitial.initialize(self, adizListener: self)
                }    
        }   

        func requestInitAdWithPlacementId(placementId: String?) {
                if let placementId = placementId,
                        placementId.count > 0 {
                        // Initialize AdizRewardedInterstitial Instance (ViewController, placementId, AdizListener)
                        self.rewardInterstitialAd = AdizRewardedInterstitial.initializeWithPlacementId(self, placementId: placementId, adizListener: self)
                }
                else {
                        // Initialize Default AdizRewardedInterstitial Instance (ViewController, AdizListener)
                        self.rewardInterstitialAd = AdizRewardedInterstitial.initialize(self, adizListener: self)
                }    
        }   

        func requestLoadAd() {
                // Load AdizRewardedInterstitial
                if let ad = self.rewardInterstitialAd,
                    ad.isInitialized() {
                        ad.load()
                }
        }     

        func requestShowAd() {
                // Show AdizRewardedInterstitial
                if let ad = self.rewardInterstitialAd,
                    ad.isLoaded() {
                        ad.show()
                }
        }     

        func requestDestroyAd() {
                // Destroy AdizRewardedInterstitial
                self.rewardInterstitialAd?.destroy()
                self.rewardInterstitialAd = nil
        }
}

extension RewardInterstitialViewController: AdizListener {
        func onLoad() {
                // requestShowAd()
        }    
        func onFail(_ error: AdizError) {
        }    
        func onShow() {
        }    
        func onClick() {
        }
        func onPaidEvent(_ revenueData: AdRevenueData) {
        }
        func onClose() {
                // requestDestroyAd()
        }
        func onRewarded(_ rewardItem: RewardItem) {
        }
}
#import <UIKit/UIKit.h>
#import <HiveAdiz/HiveAdiz-Swift.h>

@interface RewardedInterstitialViewController : UIViewController<AdizListener>
@property (nonatomic, strong) AdizRewardedInterstitial* rewardedInterstitialAd;
@end

@implementation RewardedInterstitialViewController

- (void) requestInitAd: (NSString*)hiveAdKey {
        if (hiveAdKey != nil && ![hiveAdKey isEqualToString:@""]) {
                // Initialize AdizRewardedInterstitial Instance (ViewController, hiveAdKey, AdizListener)
                self.rewardedInterstitialAd = [AdizRewardedInterstitial initialize:self hiveAdKey:hiveAdKey adizListener:self];
        }
        else {
                // Initialize Default AdizRewardedInterstitial Instance (ViewController, AdizListener)
                self.rewardedInterstitialAd = [AdizRewardedInterstitial initialize:self adizListener:self];
        }
} 

- (void) requestInitAdWithPlacementId: (NSString*)placementId {
        if (placementId != nil && ![placementId isEqualToString:@""]) {
                // Initialize AdizRewardedInterstitial Instance (ViewController, placementId, AdizListener)
                self.rewardedInterstitialAd = [AdizRewardedInterstitial initializeWithPlacementId:self placementId:placementId adizListener:self];
        }
        else {
                // Initialize Default AdizRewardedInterstitial Instance (ViewController, AdizListener)
                self.rewardedInterstitialAd = [AdizRewardedInterstitial initialize:self adizListener:self];
        }
} 

- (void) requestLoadAd {
        // Load AdizRewardedInterstitial
        if (self.rewardedInterstitialAd != nil && [self.rewardedInterstitialAd isInitialized]) {
                [self.rewardedInterstitialAd load];
        }
}

- (void) requestShowAd {
        // Show AdizRewardedInterstitial
        if (self.rewardedInterstitialAd != nil && [self.rewardedInterstitialAd isLoaded]) {
                [self.rewardedInterstitialAd show];
        }
} 

- (void) requestDestroyAd {
        // Destroy AdizRewardedInterstitial
        if (self.rewardedInterstitialAd != nil) {
                [self.rewardedInterstitialAd destroy];
                self.rewardedInterstitialAd = nil;
        }
}

#pragma mark - AdizListener

- (void) onLoad {
        // [self requestShowAd];
} 
- (void) onFail:(AdizError *)error {
} 
- (void) onShow {
} 
- (void) onClick {
} 
- (void) onPaidEvent:(AdRevenueData *)revenueData {
}

- (void) onClose {
        // [self requestDestroyAd];
}

- (void) onRewarded:(RewardItem *)rewardItem {
}

@end

App opening ads (AppOpen)

This is an app opening ad that displays pre-loaded (load()) ads when the app state changes from background to foreground. After 3 hours have passed since the ad was loaded, calling show() will automatically reload the ad and then display it. Once an ad has been displayed at least once, it will not be automatically reloaded.

import UIKit
import HiveAdiz  

class AppOpenViewController: UIViewController {

        // Create AdizAppOpen Instance
        var appOpenAd: AdizAppOpen?

        func requestInitAd(hiveAdKey: String?) {
                if let adKey = hiveAdKey,
                        adKey.count > 0 {
                        // Initialize AdizAppOpen Instance (ViewController, hiveAdKey, AdizListener)
                        self.appOpenAd = AdizAppOpen.initialize(self, hiveAdKey: adKey, adizListener: self)
                }
                else {
                        // Initialize Default AdizAppOpen Instance (ViewController, AdizListener)
                        self.appOpenAd = AdizAppOpen.initialize(self, adizListener: self)
                }    
        }     

        func requestInitAdWithPlacementId(placementId: String?) {
                if let placementId = placementId,
                        placementId.count > 0 {
                        // Initialize AdizAppOpen Instance (ViewController, placementId, AdizListener)
                        self.appOpenAd = AdizAppOpen.initializeWithPlacementId(self, placementId: placementId, adizListener: self)
                }
                else {
                        // Initialize Default AdizAppOpen Instance (ViewController, AdizListener)
                        self.appOpenAd = AdizAppOpen.initialize(self, adizListener: self)
                }    
        }   

        func requestLoadAd() {
                // Load AdizAppOpen
                if let ad = self.appOpenAd,
                    ad.isInitialized() {
                        ad.load()
                }
        }     

        func requestShowAd() {
                print("[appOpenAd] appOpenAd don't request Show")
        }     

        func requestDestroyAd() {
                // Destroy AdizAppOpen
                self.appOpenAd?.destroy()
                self.appOpenAd = nil
        }
}

extension AppOpenViewController: AdizListener {
        func onLoad() {
        }    
        func onFail(_ error: AdizError) {
        }    
        func onShow() {
        }    
        func onClick() {
        }
        func onPaidEvent(_ revenueData: AdRevenueData) {
        }
        func onClose() {
                // requestDestroyAd()
        }
}
#import <UIKit/UIKit.h>
#import <HiveAdiz/HiveAdiz-Swift.h>

@interface AppOpenViewController : UIViewController<AdizListener>
@property (nonatomic, strong) AdizAppOpen* appOpenAd;
@end

@implementation AppOpenViewController

- (void) requestInitAd: (NSString*)hiveAdKey {
        if (hiveAdKey != nil && ![hiveAdKey isEqualToString:@""]) {
                // Initialize AdizAppOpen Instance (ViewController, hiveAdKey, AdizListener)
                self.appOpenAd = [AdizAppOpen initialize:self hiveAdKey:hiveAdKey adizListener:self];
        }
        else {
                // Initialize Default AdizAppOpen Instance (ViewController, AdizListener)
                self.appOpenAd = [AdizAppOpen initialize:self adizListener:self];
        }
} 

- (void) requestInitAdWithPlacementId: (NSString*)placementId {
        if (placementId != nil && ![placementId isEqualToString:@""]) {
                // Initialize AdizAppOpen Instance (ViewController, placementId, AdizListener)
                self.appOpenAd = [AdizAppOpen initializeWithPlacementId:self placementId:placementId adizListener:self];
        }
        else {
                // Initialize Default AdizAppOpen Instance (ViewController, AdizListener)
                self.appOpenAd = [AdizAppOpen initialize:self adizListener:self];
        }
} 

- (void) requestLoadAd {
        // Load AdizAppOpen
        if (self.appOpenAd != nil && [self.appOpenAd isInitialized]) {
                [self.appOpenAd load];
        }
} 

- (void) requestShowAd {
        NSLog(@"[appOpenAd] appOpenAd don't request Show");
}

- (void) requestDestroyAd {
        // Destroy AdizAppOpen
        if (self.appOpenAd != nil) {
                [self.appOpenAd destroy];
                self.appOpenAd = nil;
        }
} 

#pragma mark - AdizListener

- (void) onLoad {
} 

- (void) onFail:(AdizError *)error {
} 

- (void) onShow {
} 

- (void) onClick {
} 

- (void) onPaidEvent:(AdRevenueData *)revenueData {
}

- (void) onClose {
        // [self requestDestroyAd];
}

@end