iOS
本指南解释了如何使用 CocoaPods 为 iOS 安装 Hive SDK。
添加 Hive SDK 存儲庫¶
在生成的 Podfile 中将 Hive SDK 仓库添加为源。
將 Hive SDK 添加到項目中¶
在您的项目目录中修改 Podfile 以添加 Hive SDK。
source 'https://github.com/CocoaPods/Specs.git'
# Add the Hive SDK repository as a source
source 'https://github.com/Com2uSPlatformCorp/HiveSDK-iOS'
platform :ios, '12.0'
use_frameworks!
inhibit_all_warnings!
$HIVE_SDK_VERSION = '24.1.0' # Hive SDK version
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 12 if it is below 12
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 12.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
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