Skip to content

iOS

Using CocoaPods

This guide explains how to install Hive SDK iOS using CocoaPods.

Add Hive SDK repository

Add the Hive SDK repository as a source in the generated Podfile.

source 'https://github.com/Com2uSPlatformCorp/HiveSDK-iOS'

Add SDK to Xcode project

Modify the Podfile in your Xcode project directory to add Hive SDK.

source 'https://github.com/CocoaPods/Specs.git'
# Add the SDK repository as a source
source 'https://github.com/Com2uSPlatformCorp/HiveSDK-iOS'

$HIVE_SDK_VERSION = '26.1.0'                    # SDK version to use
$IOS_DEPLOYMENT_TARGET_VERSION = '13.0'         # Minimum iOS version supported by the game
$IOS_DEPLOYMENT_MINIMUM_TARGET_VERSION = '13.0' # Minimum iOS version supported by the SDK version to use (refer to the release notes for the SDK version)

platform :ios, $IOS_DEPLOYMENT_TARGET_VERSION
use_frameworks!
inhibit_all_warnings!

project 'HIVE_SDK_Sample_App.xcodeproj'

target 'HIVE_SDK_Sample_App' do
  # Add the frameworks to use here. At least one framework is required.
  # Example: Add the following framework when using Google IdP login in Hive SDK Authentication
  pod 'HiveAuthV4ProviderGoogle', $HIVE_SDK_VERSION # When using Google IdP login for Authentication (authv4)
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
     # Change the iOS target of each framework to 15 if it is below 15
     if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < $IOS_DEPLOYMENT_MINIMUM_TARGET_VERSION.to_f
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $IOS_DEPLOYMENT_MINIMUM_TARGET_VERSION.to_f
     end
     # Handle xcode 15 TOOLCHAIN_DIR related compile error issues
     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
  end
end

Using Swift Package Manager (Beta)

This guide explains how to install iOS SDK using Swift Package Manager (SPM).

  1. Select the Add Package menu in your Xcode project.

    Unity

    If you have built an Xcode project after installing Hive SDK in a Unity environment, you must first run pod deintegrate if pod install has already been executed automatically.

  2. Find the Hive SDK package repository and specify the version.

    1. Enter the following address in 1.

      https://github.com/Com2uSPlatformCorp/HiveSDK-iOS-SPM
      
    2. Select Exact Version in 2 and enter the SDK version you want to apply.

    3. Click 3.

  3. After the package loading is complete and the product list appears, apply the desired Hive SDK products (authentication, billing, analytics, etc.) to the app target.

    Warning

    The following Hive SDK products that do not support SPM must be added using CocoaPods.

    • HerculesSwift
    • HiveAuthV4ProviderQQ
    • HiveAuthV4ProviderLine
    • HiveAuthV4ProviderWechat
    • HiveAnalyticsProviderAirbridge

    Write the pod statements for these in your Podfile and run pod install. At this time, you must not include Hive SDK products that have already been applied via SPM. If there are additional dependencies to apply, you can also add them using CocoaPods.

    Unity

    If you have generated an Xcode project after installing Hive SDK in a Unity environment, apply the Hive SDK products to the UnityFramework target instead of the app target. However, Hive_AuthV4ProviderFacebook and Hive_AnalyticsProviderAdjust products must also be added to the main app target (Unity-iPhone).

  4. Add the following two values in order to Other Linker Flags (OTHER_LDFLAGS) in the Build Settings of the main app target.

    • -Xlinker
    • -all_load