Skip to content

iOS

Install with CocoaPods

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

Add the Hive SDK repository

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

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

Add Hive SDK to Xcode project

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

source 'https://github.com/CocoaPods/Specs.git'
# Add SDK repository as 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 being used)

platform :ios, $IOS_DEPLOYMENT_TARGET_VERSION
use_frameworks!
inhibit_all_warnings!

project 'HIVE_SDK_Sample_App.xcodeproj'

target 'HIVE_SDK_Sample_App' do
  # Add frameworks to use here. At least one framework must be present.
  # Example: Add the following framework when using Google IdP login in authentication
  pod 'HiveAuthV4ProviderGoogle', $HIVE_SDK_VERSION # When using Google IdP login in authentication (AuthV4)
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
     # Change to 15 if iOS target of each framework is less than 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
     # Fix for Xcode 15 TOOLCHAIN_DIR related compilation error
     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

Install with Swift Package Manager (Beta)

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

Add SDK package to Unity project

In Unity environment, the default value for SPM usage is true. Therefore, Hive SDK that supports SPM is installed with SPM by default, and Hive SDK that does not support SPM is installed with CocoaPods.

In Unity environment, you can add Hive SDK iOS package more conveniently by using the PostProcess feature provided by Hive SDK, which automatically adds package dependencies.

Note

Even for Hive SDK that supports SPM, if you want to install with CocoaPods instead of SPM, uncheck iOS Resolver Settings > Swift Package Manager Integration in Unity Editor under Assets > External Dependency Manager > iOS Resolver > Settings.

Add SDK package to non-Unity projects

Add the Hive SDK iOS package to your Xcode project in the following order:

  1. Click File > Add Package Dependencies...

  2. Register the Hive SDK iOS package in the following order:

    2.1. Enter the address corresponding to the Hive SDK iOS package repository as follows:

    https://github.com/Com2uSPlatformCorp/HiveSDK-iOS-SPM
    

    2.2. Select Exact Version in Dependency Rule and enter the SDK version you want to apply.

    2.3. Click Add Package.

  3. When package loading is complete, a list of features provided by Hive SDK iOS (authentication, billing, analytics, etc.) is displayed. You can add the features you want to apply to the app target.

    Warning

    The following Hive SDK features that do not support SPM must be added using CocoaPods:

    • HerculesSwift
    • HiveAuthV4ProviderQQ
    • HiveAuthV4ProviderLine
    • HiveAuthV4ProviderWechat
    • HiveAnalyticsProviderAirbridge

    Write dependencies for each feature in the Podfile using pod syntax and then run pod install.
    Additionally, if there are more dependencies to apply, you can add them using CocoaPods in the same way. In this case, do not include Hive SDK features already added via SPM.

  4. In the main app target's Build Settings, add the following two values to Other Linker Flags (OTHER_LDFLAGS) in order:

    • -Xlinker
    • -all_load