Apps Kit SDK logoApps Kit SDK
文档 · iOS 集成

1. 依赖项(Podfile)

1.1 为什么仍然需要 Podfile

AKSKit.xcframework/AppsKit.xcframework 以二进制框架的形式直接链接(§2),而不是通过 pod 集成。但 AppsKit.xcframework 中已编译的 Swift 模块会引用多个第三方 SDK(Firebase、Google Mobile Ads、IronSource、Adjust、AppsFlyer、AppLovin)的符号。这些 SDK 必须通过 CocoaPods 加入依赖关系图,否则构建时会链接失败,即使你从未直接调用其中的大多数 SDK。

1.2 必需的 pod(始终需要)

ruby
source 'https://cdn.cocoapods.org'

platform :ios, '15.0'

target 'YourApp' do
  use_frameworks!

  # Remote Config drives almost all AKS behavior; Analytics/Crashlytics back AKS events and crash reporting
  pod 'Firebase/Analytics',    '~> 12.15.0'
  pod 'Firebase/Crashlytics',  '~> 12.15.0'
  pod 'Firebase/RemoteConfig', '~> 12.15.0'

  pod 'Google-Mobile-Ads-SDK'

  # Required by AppsKit.xcframework's compiled swiftinterface — these are transitive
  # dependencies of the AKS facade itself, not direct calls you make.
  pod 'IronSourceSDK',         '~> 9.1.0.0'
  pod 'Adjust',                '~> 5.4.6'
  pod 'AppsFlyerFramework'
  pod 'AppsFlyer-AdRevenue'

  pod 'AppLovinSDK'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
      config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf-with-dsym'
    end
  end
end

上述版本来自一个已验证可正常工作的参考集成,其当前解析结果记录在 Podfile.lock 中:Firebase/* 12.15.0、未锁定版本以跟进最新版的 Google-Mobile-Ads-SDK(会通过传递依赖引入 GoogleUserMessagingPlatform)、IronSourceSDK 9.1.0.0、Adjust 5.4.6、AppsFlyerFramework/AppsFlyer-AdRevenue 6.14.3、AppLovinSDK 13.5.0。请将这些版本视为已验证可用的基线,而非必须锁定的版本。你可以根据应用需求升级,但应将 IPHONEOS_DEPLOYMENT_TARGET 保持为 15.0 或更高版本,以匹配构建 AppsKit.xcframework/AKSKit.xcframework 时使用的最低部署目标版本。

post_install 中的 DEBUG_INFORMATION_FORMAT = 'dwarf-with-dsym' 并非可有可无的配置。缺少这一行,部分 pod(尤其是 AppLovinSDK)不会生成 dSYM 文件,导致崩溃堆栈无法符号化,还可能在上传时无法通过 App Store Connect 的 dSYM 校验。

1.3 MMP SDK

Solar Engine 不是需要自行添加的 pod——它已编译进 AKSKit.xcframework,因此你不会在 Podfile 中找到它,也无需添加。相比之下,AppsFlyer 和 Adjust 确实是需要由接入方添加的 pod(见上文 §1.2),因为 AppsKit.xcframework 的 Swift 代码会直接调用它们实际的 SDK 方法(IOSBridgeImp.swift 中的 initializeAppsFlyer/initializeAdjust)。

1.4 广告网络 / 广告聚合 SDK

参考 Podfile 仅添加了 Google-Mobile-Ads-SDK、IronSourceSDK 和 AppLovinSDK,没有单独添加“AdMob 聚合适配器”pod。如果你的 AKS 门户配置启用了通过 AdMob 对其他未列出的广告网络进行竞价或瀑布流聚合,请确认该广告网络是否需要专用的 CocoaPods 适配器(例如 GoogleMobileAdsMediation* pod)。本指南仅涵盖已在参考应用中验证可用的配置。