Install SDK

了解如何下载和安装iOS SDK。

开始之前

Get started with our SDK integration wizard

下载并安装SDK

用您选择的软件包管理器下载并安装iOS SDK。

Install using CocoaPods

推荐

Step 1: Download CocoaPods
下载并安装最新版本的CocoaPods。

步骤2:添加依赖项
Add the latest version of AppsFlyerFramework to your project's Podfile:

pod 'AppsFlyerFramework'

步骤3:安装依赖项
In your terminal, navigate to your project's root folder and run pod install.

步骤4:打开Xcode工作区
In Xcode, use the .xcworkspace file to open the project from this point forward, instead of the .xcodeproj file.

If you are developing a tvOS app, CocoaPods automatically adds the relevant dependencies from AppsFlyerFramework.

Install using Carthage

步骤1:安装Carthage
安装最新版本的Carthage。

步骤2:添加依赖项
Add the following line to your Cartfile binary:

binary "https://raw.githubusercontent.com/AppsFlyerSDK/AppsFlyerFramework/master/Carthage/appsflyer-ios.json"

目前不支持tvOS应用程序

📘

注意

上面的链接链接到静态库。如果你更新了一个新的IOS版本,请执行如下操作:

  1. 在运行copy-frameworks的Xcode中移除Run Script stage。
  2. 确保未嵌入库。

To learn more, see Carthage docs.

Install using Swift Package Manager (V6.1.0+)

Starting V6.1.0 the iOS SDK can be installed via Install using Swift Package Manager (SPM):
Step 1: Navigate to Add Package Dependency
In Xcode, go to File > Add Packages:

1572

步骤2:添加iOS SDK GitHub存储库
Enter the AppsFlyer SDK GitHub repository. You can select one of the following:

2172

步骤3:选择SDK版本

2176

步骤4:将AppsFlyerLib添加到所需目标

2168

Manual install

步骤1:下载静态框架
Download the iOS SDK as a static framework.

要验证SDK静态框架下载的完整性,请点击此处

步骤2:解压缩
Unzip the AppsFlyerLib.framework.zip file you just downloaded.

步骤3:导入项目
Drag the AppsFlyerLib.framework folder and drop it into your Xcode project. Make sure Copy items if needed is checked.

📘

注意

This approach is only compatible with iOS 8 and above. For tvOS apps, you need a different AppsFlyerFramework:

  1. Clone this repo.
  2. Find AppsFlyerLib.framework in this folder of the cloned repo.
  3. 重复步骤3。

原生iOS框架依赖项

SDK会自动添加并使用以下原生框架:

  • AdSupport framework: This framework is required to collect the IDFA from devices. Without IDFA you cannot attribute installs to Meta ads, Twitter, Google Ads, and other networks.
  • AdServices framework (V6.1.3+): Measure the performance of Apple Search Ads in your app.
  • iAd framework: (Deprecated) Measure the performance of Apple Search Ads in your app. Note: The iAd framework has not been in use since V6.10.1 and completely removed from the code base from V6.13.0.

严格模式SDK

使用strict mode(严格模式)SDK可以彻底禁用IDFA收集功能,并且完全不依赖AdSupport框架(适用于面向儿童的应用等)。

您可以使用以下方法之一安装严格模式的SDK。

Install using CocoaPods

pod 'AppsFlyerFramework/Strict'

Install using Carthage

binary "https://raw.githubusercontent.com/AppsFlyerSDK/AppsFlyerFramework/master/Carthage/appsflyer-strict.json" ~> 6.3.2

Install using Swift Package Manager

Follow the steps to install the SDK using Swift Package Manager, and in the repository name, use https://github.com/AppsFlyerSDK/AppsFlyerFramework-Strict