Install the Airbridge iOS SDK and implement the necessary settings following the steps below.
The Airbridge iOS SDK can be installed using the method below. After installation, you can verify whether the SDK has been properly installed through the iOS SDK Test.
1. 请在 Xcode 中导航至 [File]>[Add Packages...]。
2. 请在搜索栏中输入以下地址,并点击 [Add Package]。
3. 请再次点击 [Add Package]。
4. 请在 Xcode 的 [Package Dependencies] 中确认 Airbridge iOS SDK 已成功添加。
注意
在安装 iOS SDK 之前,请导航至 [Xcode]>[YOUR_PROJECT]>[Build Settings],并确保将 User Script Sandboxing 设置为 “No”。更多信息请参阅 CocoaPods 文档。
1. 请使用 brew install cocoapods
安装 CocoaPods。
2. 请使用 pod init
创建 Podfile。
3. 请使用以下代码将 SDK 添加为 Podfile 的依赖项。
target '[Project Name]' do
...
# choose YOUR_VERSION from https://help.airbridge.io/developers/release-note-ios-sdk
# example: pod 'airbridge-ios-sdk', '4.X.X'
pod 'airbridge-ios-sdk', 'YOUR_VERSION'
...
end
4. 在输入 pod install --repo-update
时,安装将开始。
5. 请运行 YOUR_PROJECT.xcworkspace
以确认 Airbridge iOS SDK 成功安装。
注意
您无法使用 Tuist 的 External Dependencies 安装 Airbridge iOS SDK。请确保按照以下步骤安装。
1. 请运行 tuist edit
命令。
2. 请将 remote
添加到 project.packages
。请将 package
添加到 project.targets[...].target.dependencies
中。请参见以下代码:
import ProjectDescription
let project = Project(
packages: [
.remote(
url: "https://github.com/ab180/airbridge-ios-sdk-deployment",
// choose YOUR_VERSION from https://help.airbridge.io/developers/release-note-ios-sdk
// example: requirement: .exact(from: "4.X.X")
requirement: .exact(from: "YOUR_VERSION")
),
...
],
targets: [
.target(
dependencies: [
.package(product: "Airbridge", type: .runtime),
...
]
),
...
],
...
)
3. 请运行 tuist generate
命令。
4. Airbridge 将添加至 Xcode 的 Package Dependencies 中。
1. 请从以下链接下载 Airbridge iOS SDK:
2. 请将 Airbridge.xcframework 添加到 Project 中。请导航至 [Xcode]>[Project File]>[General]>[Frameworks, Libraries, and Embedded Content],并点击 “+”。
3. 请在 [Add Other...] 下点击 “Add Files...”,并选择 Airbridge.xcframework。
4. 请将 Airbridge.xcframework 中的 Embed(嵌入)设置为 Do Not Embed(不嵌入)。
5. 请将 SDK 依赖的 Framework 添加到 Project 中。请导航至 [Xcode]>[Project File]>[General]>[Frameworks, Libraries, and Embedded Content],并点击 “+”。
6. 请添加所有以下 Framework,并将已添加 Framework 的 Embed(嵌入)设置为 Do Not Embed(不嵌入)。请导航至 [Xcode]>[Project File]>[Build Phase]>[Link Binary With Libraries],将 Status(状态)设置为 “Optional(可选)”。
Framework | 说明 |
---|---|
AdSupport.framework | 用于收集 IDFA |
CoreTelephony.framework | 用于收集移动通信运营商信息 |
StoreKit.framework | 用于收集 SKAN 信息 |
AppTrackingTransparency.framework | 用于收集 ATT 同意状态信息 |
AdServices.framework | 用于收集 Apple Ads 归因信息(iOS 14.3+) |
提示
请根据需求选择 General SDK 或 Restricted SDK, 只能安装其中一个。
Depending on policies and environments, restrictions on collecting device IDs like GAID and IDFA may be required. When installing the Restricted SDK version, the device IDs are not collected.
Install the Restricted SDK using the method below.
1. 请在 Xcode 中导航至 [File]>[Add Packages...]。
2. 请在搜索栏中输入以下地址,并点击 [Add Package]。
3. 请再次点击 [Add Package]。
4. 请在 Xcode 的 [Package Dependencies] 中确认 Airbridge iOS SDK 已成功添加。
注意
在安装 iOS SDK 之前,请导航至 [Xcode]>[YOUR_PROJECT]>[Build Settings],并确保将 User Script Sandboxing 设置为 “No”。更多信息请参阅 CocoaPods 文档。
1. 请使用 brew install cocoapods
安装 CocoaPods。
2. 请使用 pod init
创建 Podfile。
3. 请使用以下代码将 SDK 添加为 Podfile 的依赖项。
target '[Project Name]' do
...
# choose YOUR_VERSION from https://help.airbridge.io/developers/release-note-ios-sdk
# example: pod 'airbridge-ios-sdk-restricted', '4.X.X'
pod 'airbridge-ios-sdk-restricted', 'YOUR_VERSION'
...
end
4. 在输入 pod install --repo-update
时,安装将开始。
5. 请运行 YOUR_PROJECT.xcworkspace
以确认 Airbridge iOS SDK 成功安装。
注意
您无法使用 Tuist 的 External Dependencies 安装 Airbridge iOS SDK。请确保按照以下步骤安装。
1. 请运行 tuist edit
命令。
2. 请将 remote
添加到 project.packages
。请将 package
添加到 project.targets[...].target.dependencies
中。请参见以下代码:
import ProjectDescription
let project = Project(
packages: [
.remote(
url: "https://github.com/ab180/airbridge-ios-sdk-restricted-deployment",
// choose YOUR_VERSION from https://help.airbridge.io/developers/release-note-ios-sdk
// example: requirement: .exact(from: "4.X.X")
requirement: .exact(from: "YOUR_VERSION")
),
...
],
targets: [
.target(
dependencies: [
.package(product: "Airbridge", type: .runtime),
...
]
),
...
],
...
)
3. 请运行 tuist generate
命令。
4. Airbridge 将添加至 Xcode 的 Package Dependencies 中。
1. 请从以下链接下载 Airbridge iOS SDK。
2. 请将 Airbridge.xcframework 添加到 Project 中。请导航至 [Xcode]>[Project File]>[General]>[Frameworks, Libraries, and Embedded Content],并点击 “+”。
3. 请在 [Add Other...] 下点击 “Add Files...”,并选择 Airbridge.xcframework。
4.请将 Airbridge.xcframework 中的 Embed(嵌入)设置为 Do Not Embed(不嵌入)。
5. 请将 SDK 依赖的 Framework 添加到 Project 中。请导航至 [Xcode]>[Project File]>[General]>[Frameworks, Libraries, and Embedded Content],并点击 “+”。
6. 请添加所有以下 Framework,并将已添加 Framework 的 Embed(嵌入)设置为 Do Not Embed(不嵌入)。请导航至 [Xcode]>[Project File]>[Build Phase]>[Link Binary With Libraries],将 Status(状态)设置为 “Optional(可选)”。
Framework | 说明 |
---|---|
CoreTelephony.framework | 用于收集移动通信运营商信息 |
StoreKit.framework | 用于收集 SKAN 信息 |
AdServices.framework | 用于收集 Apple Ads 的归因信息(iOS 14.3+) |
SDK initialization methods vary depending on the system architecture. For SceneDelegate Lifecycle or AppDelegate Lifecycle, refer to the method for AppDelegate. For SwiftUI Lifecycle, refer to the method for SwiftUI.
The YOUR_APP_NAME and YOUR_APP_SDK_TOKEN can be found on the [Settings]>[Tokens] page in the Airbridge dashboard.
请在 AppDelegate
的 application(_:didFinishLaunchingWithOptions:)
函数顶部调用 Airbridge.initializeSDK
函数。
import UIKit
import Airbridge
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
return true
}
}
请在 AppDelegate 的 application:didFinishLaunchingWithOptions:
函数顶部调用 Airbridge.initializeSDK
函数。
#import "AppDelegate.h"
#import <Airbridge/Airbridge.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
token:@"YOUR_APP_SDK_TOKEN"];
AirbridgeOption* option = [optionBuilder build];
[Airbridge initializeSDKWithOption:option];
return YES;
}
@end
请在 init
的顶部调用 Airbridge.initializeSDK
函数。
import SwiftUI
import Airbridge
@main
struct ExampleApp: App {
init() {
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
注意
SwiftUI Lifecycle 方法不提供 ReferrerURL,因此无法使用 Organic Referrer Attribution。即使使用 UIApplicationDelegateAdaptor,在 SwiftUI Lifecycle 方法中也无法使用 Organic Referrer Attribution。
提示
为确保遵守隐私政策所需的功能,应与法律顾问共同审查。
The IDFA can only be collected if users consent to data tracking via the App Tracking Transparency (ATT) prompt.
Event collection should be delayed until the user allows tracking. If the install event is collected before the user allows tracking on the ATT prompt, the install event data will lack an identifier, making performance measurement difficult. We recommend setting a sufficient delay time for event collection to collect identifiers.
1. Prepare the text you will use in the ATT prompt.
2. Enter the prepared text in the NSUserTrackingUsageDescription
key of the Info.plist
file.
请导航至 [Xcode]>[YOUR_PROJECT]>[Info]>[Custom iOS Target Properties]。
请将鼠标悬停在 Key 的项目,点击出现的 “+”,并输入 Privacy - Tracking Usage Description
。
请将准备好的 ATT 弹窗文本作为值输入。
1. 请输入 tuist edit 命令。
2. 请在 project.targets[...].infoPlist
的 .extendingDefault
中,作为键输入 NSUserTrackingUsageDescription
,作为值输入准备好的 ATT 弹窗文本。
import ProjectDescription
let project = Project(
targets: [
.target(
infoPlist: .extendingDefault(
with: [
"NSUserTrackingUsageDescription": "YOUR_DESCRIPTION",
...
]
),
...
),
...
]
...
)
3. Set the point of time for displaying the ATT prompt on the app.
请在计划弹出 ATT 弹窗的时间调用 ATTrackingManager.requestTrackingAuthorization
函数。
import AppTrackingTransparency
...
ATTrackingManager.requestTrackingAuthorization { _ in }
#import <AppTrackingTransparency/AppTrackingTransparency.h>
...
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {}];
注意
当调用
ATTrackingManager.requestTrackingAuthorization
函数时,如果 App 不处于 Active 状态,则不会弹出 ATT 弹窗。
App 启用后可立即弹出 ATT 弹窗。
import Airbridge
import AppTrackingTransparency
...
var observer: Any?
...
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
...
observer = NotificationCenter.default.addObserver(
forName: UIApplication.didBecomeActiveNotification,
object: nil,
queue: nil
) { [weak self] _ in
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { _ in }
}
if let observer = self?.observer {
NotificationCenter.default.removeObserver(observer)
}
}
#import <Airbridge/Airbridge.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>
...
id observer;
...
AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
token:@"YOUR_APP_SDK_TOKEN"];
[optionBuilder setAutoDetermineTrackingAuthorizationEnabled:NO];
AirbridgeOption* option = [optionBuilder build];
[Airbridge initializeSDKWithOption:option];
...
__weak typeof(self) weakSelf = self;
observer = [NSNotificationCenter.defaultCenter addObserverForName:UIApplicationDidBecomeActiveNotification
object:nil
queue:nil
usingBlock:^(NSNotification * _Nonnull notification) {
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {}];
}
if (weakSelf != nil && weakSelf->observer != nil) {
[NSNotificationCenter.defaultCenter removeObserver:observer];
}
}];
import SwiftUI
import Airbridge
import AppTrackingTransparency
@main
struct ExampleApp: App {
var observer: Any?
init() {
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
observer = NotificationCenter.default.addObserver(
forName: UIApplication.didBecomeActiveNotification,
object: nil,
queue: nil
) { [weak self] _ in
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { _ in }
}
if let observer = self?.observer {
NotificationCenter.default.removeObserver(observer)
}
}
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
4. If the install event is not collected, the Airbridge iOS SDK delays collecting install events for 30 seconds until the user allows tracking each time the app is launched. If the user exits the app before deciding whether to allow tracking, the SDK will not collect the install event and will try again at the next app launch.
When using the DeepLink Plan, it is recommended that the
setAutoDetermineTrackingAuthorizationTimeout
parameter be set to 0 seconds when configuring the ATT prompt.As the DeepLink Plan does not support attribution using identifiers, the
setAutoDetermineTrackingAuthorizationTimeout
parameter should be set to 0 seconds to seamlessly redirect users who have already installed the app to the intended in-app location as configured in the deferred deep link.
The autoDetermineTrackingAuthorizationTimeout
function can be used to set a longer delay for collecting install events. The default setting for the autoDetermineTrackingAuthorizationTimeout
is 300 seconds. It can be set up to 3600 seconds (1 hour).
import Airbridge
...
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME",
token: "YOUR_APP_SDK_TOKEN")
.setAutoDetermineTrackingAuthorizationTimeout(second: 30)
.build()
Airbridge.initializeSDK(option: option)
#import <Airbridge/Airbridge.h>
...
AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
token:@"YOUR_APP_SDK_TOKEN"];
[optionBuilder setAutoDetermineTrackingAuthorizationTimeoutWithSecond:30];
AirbridgeOption* option = [optionBuilder build];
[Airbridge initializeSDKWithOption:option];
注意
请确保为延迟收集安装事件预留足够时间。在用户通过 ATT 弹窗允许追踪之前,如果延迟时间到期,SDK 将会收集不包含 IDFA 的安装事件。
Deep linking allows you to redirect users from ads to specific locations within your app. The data collected from the tracking link enables you to monitor the performance of the deep link in Airbridge.
When a user clicks on the Airbridge tracking link, the scheme deep link embedded in the tracking link is converted into an Airbridge Deep Link, which can be either an HTTP deep link or a scheme deep link. This Airbridge Deep Link redirects the user to the desired app location. Then, the Airbridge SDK converts the Airbridge Deep Link back to the original scheme deep link embedded in the tracking link and passes it to the app.
Example scheme deep link embedded in the tracking link: YOUR_SCHEME://product/12345
Examples of Airbridge Deep Links
HTTP deep link format 1: https://YOUR_APP_NAME.airbridge.io/~~~
HTTP deep link format 2: https://YOUR_APP_NAME.abr.ge/~~~
Scheme deep link format: YOUR_SCHEME://product/12345?airbridge_referrer=~~~
When the app is installed on the device and the tracking link is clicked, the app opens through the Airbridge Deep Link. The Airbridge SDK converts the Airbridge Deep Link into the scheme deep embedded in the tracking link and passes it to the app.
When the app is not installed on the device and the tracking link is clicked, the Airbridge SDK saves the Airbridge Deep Link is saved. After the user is redirected to the app store or website and the app is installed and launched, the Airbridge SDK converts the saved Airbridge Deep Link into the scheme deep embedded in the tracking link and passes it to the app.
For the deep linking setup, the deep link information entered to the Airbridge dashboard and the in-app location address for user redirection is required.
First, enter the deep link information into the Airbridge dashboard.
请前往 [追踪链接]>[深度链接] 注册以下信息:
iOS URI Scheme:根据 iOS URI Scheme,将 Airbridge 深度链接转换为 URI Scheme 深度链接。URI Scheme 需要此信息。
iOS App ID:根据 iOS App ID,为 Airbridge 深度链接设置 Universal Link 域名。Universal Link 需要此信息。
注意
为确保正确的用户跳转,请为正式版 App 和 开发用 App 注册不同的 iOS URI Scheme 和 iOS App ID。
请按照以下步骤将上述信息注册至 Airbridge 面板。
1. 请前往 [追踪链接]>[深度链接]。
2. 请在 [iOS URI Scheme] 中输入 iOS URI Scheme,该 URI Scheme 必须与 ://
一起输入。例如,如果 iOS URI Scheme 是 demo
,则输入 demo://
。
3. 请在 Apple Developer Dashboard,进入您要设置深度链接的 App 的 [Identifier] 页面,获取 App ID Prefix 和 Bundle ID。
4. iOS App ID 的格式为 App ID Prefix
+ .
+ Bundle ID
。请在 Airbridge 面板 [追踪链接]>[深度链接]>[iOS App ID] 中输入 iOS App ID。
例如,如果 App ID Prefix 是 prefix,Bundle ID 是 example,则 iOS App ID 为 prefix.example
。
After entering the deep link information into the Airbridge dashboard, refer to the information below for app setup. The instructions vary by the app system.
请进行设置启用以下功能:
使用 Airbridge 深度链接启用 App
在 App 收集 Airbridge 深度链接事件
使用 Airbridge 深度链接实现用户跳转
当用户点击追踪链接时,App 应通过 Airbridge 深度链接启用。
1. 需要在 App 进行 Airbridge 深度链接的 URI Scheme 深度链接设置。请在 Xcode 中导航至 [YOUR_PROJECT]>[Info]>[URL Types]。
2. 请点击 “+”,并在 URL Schemes 中输入已在 Airbridge 面板中注册的 iOS URI Scheme。
注意
必须输入不包括
://
的 iOS URI Scheme。
3. 需要在 App 进行 Airbridge 深度链接的 Universal Link 设置。请在 Xcode 中导航至 [YOUR_PROJECT]>[Signing & Capabilities]。
4. 请点击 “+ Capability” 以添加 Associated Domains。
5. 请将 applinks:YOUR_APP_NAME.airbridge.io
和 applinks:YOUR_APP_NAME.abr.ge
添加到 Associated Domains。YOUR_APP_NAME
是 Airbridge App 名称。
注意
如果您正在使用或计划使用 Password AutoFill 功能,则必须添加 Webcredentials 域名。否则用户可能会看到通过 Password AutoFill 功能保存的密码域名显示为 airbridge.io 或 abr.ge。
更多信息请参阅 本指南。
注意
在 iOS,无法自动收集深度链接事件。必须使用
Airbridge.trackDeeplink
函数将深度链接事件传递给 Airbridge SDK。
为了收集深度链接事件,必须将深度链接事件传递给 Airbridge SDK。当 App 通过深度链接启用时,请在调用的 OS 回调顶部调用 Airbridge.trackDeeplink
函数。
import Airbridge
...
Airbridge.trackDeeplink(url: url)
Airbridge.trackDeeplink(userActivity: userActivity)
#import <Airbridge/Airbridge.h>
...
[Airbridge trackDeeplinkWithUrl:url];
[Airbridge trackDeeplinkWithUserActivity:userActivity];
请根据 App 状态进行设置:
1. 当已关闭的 App 通过 URI Scheme 深度链接或 Universal Link 重新启用时,请在调用的函数中调用 Airbridge.trackDeeplink
函数。
import Airbridge
...
// when terminated app is opened with scheme deeplink or universal links
func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
// when app is opened with scheme deeplink
if let url = connectionOptions.urlContexts.first?.url {
// track deeplink
Airbridge.trackDeeplink(url: url)
}
// when app is opened with universal links
else if let userActivity = connectionOptions.userActivities.first {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
}
}
#import <Airbridge/Airbridge.h>
...
// when terminated app is opened with scheme deeplink or universal links
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// when app is opened with scheme deeplink
NSURL* url = connectionOptions.URLContexts.allObjects.firstObject.URL;
NSUserActivity* userActivity = connectionOptions.userActivities.allObjects.firstObject;
if (url != nil) {
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
}
else if (userActivity != nil) {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
}
}
2. 当后台中的 App 通过 URI Scheme 深度链接启用时,请在调用的函数中调用 Airbridge.trackDeeplink
函数。
import Airbridge
...
// when backgrounded app is opened with scheme deeplink
func scene(
_ scene: UIScene,
openURLContexts URLContexts: Set<UIOpenURLContext>
) {
guard let url = URLContexts.first?.url else { return }
// track deeplink
Airbridge.trackDeeplink(url: url)
}
#import <Airbridge/Airbridge.h>
...
// when backgrounded app is opened with scheme deeplink
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
NSURL* url = URLContexts.allObjects.firstObject.URL;
if (url == nil) { return; }
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
}
3. 当后台中的 App 通过 Universal Link 启用时,请在调用的函数中调用 Airbridge.trackDeeplink
函数。
import Airbridge
...
// when backgrounded app is opened with universal links
func scene(
_ scene: UIScene,
continue userActivity: NSUserActivity
) {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
}
// when backgrounded app is opened with universal links
- (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
}
为确保将用户发送到目标页面,必须使用 Airbridge.handleDeeplink
函数将 Airbridge 深度链接转换为 URI Scheme 深度链接。
import Airbridge
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
#import <Airbridge/Airbridge.h>
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
Airbridge.handleDeeplink
函数在输入 Airbridge 深度链接时,会返回 true
并通过回调提供 URI Scheme 深度链接。如果不是 Airbridge 深度链接,则返回 false
,且不提供回调。利用此功能,可以分开处理通过 Airbridge 启用的深度链接。
根据系统方式和 App 状态,在通过深度链接启用的 App 调用的 OS 回调中,将 Airbridge.handleDeeplink
函数放置在 Airbridge.trackDeeplink
函数的正下方调用。如有必要,应将现有逻辑一并处理。
1. 请在 SceneDelegate 中实现处理通过 Airbridge 深度链接启用的 App 的函数。
import Foundation
...
// when app is opened with airbridge deeplink
func handleAirbridgeDeeplink(url: URL) {
// show proper content using url (YOUR_SCHEME://...)
}
import Foundation
...
// when app is opened with airbridge deeplink
- (void)handleAirbridgeDeeplink:(NSURL *)url {
// show proper content using url (YOUR_SCHEME://...)
}
2. 当已关闭的 App 通过 URI Scheme 深度链接或 Universal Link 重新启用时,请在调用的函数中调用 Airbridge.handleDeeplink
函数。转换后的 URI Scheme 深度链接将用户发送到预设的目标页面。
import Airbridge
...
// when terminated app is opened with scheme deeplink or universal links
func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
// when app is opened with scheme deeplink
if let url = connectionOptions.urlContexts.first?.url {
// track deeplink
Airbridge.trackDeeplink(url: url)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
// when app is opened with universal links
else if let userActivity = connectionOptions.userActivities.first {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
}
#import <Airbridge/Airbridge.h>
...
// when terminated app is opened with scheme deeplink or universal links
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// when app is opened with scheme deeplink
NSURL* url = connectionOptions.URLContexts.allObjects.firstObject.URL;
NSUserActivity* userActivity = connectionOptions.userActivities.allObjects.firstObject;
if (url != nil) {
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
}
else if (userActivity != nil) {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
}
}
3. 当后台中的 App 通过 URI Scheme 深度链接启用时,请在调用的函数中调用 Airbridge.handleDeeplink
函数。转换后的 URI Scheme 深度链接将用户发送到预设的目标页面。
import Airbridge
...
// when backgrounded app is opened with scheme deeplink
func scene(
_ scene: UIScene,
openURLContexts URLContexts: Set<UIOpenURLContext>
) {
guard let url = URLContexts.first?.url else { return }
// track deeplink
Airbridge.trackDeeplink(url: url)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
#import <Airbridge/Airbridge.h>
...
// when backgrounded app is opened with scheme deeplink
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
NSURL* url = URLContexts.allObjects.firstObject.URL;
if (url == nil) { return; }
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
}
4. 当后台中的 App 通过 Universal Link 启用时,请在调用的函数中调用 Airbridge.handleDeeplink
函数。转换后的 URI Scheme 深度链接将用户发送到预设的目标页面。
import Airbridge
...
// when backgrounded app is opened with universal links
func scene(
_ scene: UIScene,
continue userActivity: NSUserActivity
) {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
// when backgrounded app is opened with universal links
- (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
}
请进行设置启用以下功能:
使用 Airbridge 深度链接启用 App
在 App 收集 Airbridge 深度链接事件
使用 Airbridge 深度链接实现用户跳转
当用户点击追踪链接时,App 应通过 Airbridge 深度链接启用。
1. 需要在 App 进行 Airbridge 深度链接的 URI Scheme 深度链接设置。请在 Xcode 中导航至 [YOUR_PROJECT]>[Info]>[URL Types]。
2. 请点击 “+”,并在 URL Schemes 中输入已在 Airbridge 面板中注册的 iOS URI Scheme。
注意
必须输入不包括
://
的 iOS URI Scheme。
3. 需要在 App 进行 Airbridge 深度链接的 Universal Link 设置。请在 Xcode 中导航至 [YOUR_PROJECT]>[Signing & Capabilities]。
4. 请点击 “+ Capability” 以添加 Associated Domains。
5. 请将 applinks:YOUR_APP_NAME.airbridge.io
和 applinks:YOUR_APP_NAME.abr.ge
添加到 Associated Domains。YOUR_APP_NAME
是 Airbridge App 名称。
注意
如果您正在使用或计划使用 Password AutoFill 功能,则必须添加 Webcredentials 域名。否则用户可能会看到通过 Password AutoFill 功能保存的密码域名显示为 airbridge.io 或 abr.ge。
更多信息请参阅 本指南。
注意
在 iOS,无法自动收集深度链接事件。必须使用
Airbridge.trackDeeplink
函数将深度链接事件传递给 Airbridge SDK。
为了收集深度链接事件,必须将深度链接事件传递给 Airbridge SDK。当 App 通过深度链接启用时,请在调用的 OS 回调顶部调用 Airbridge.trackDeeplink
函数。
import Airbridge
...
Airbridge.trackDeeplink(url: url)
Airbridge.trackDeeplink(userActivity: userActivity)
#import <Airbridge/Airbridge.h>
...
[Airbridge trackDeeplinkWithUrl:url];
[Airbridge trackDeeplinkWithUserActivity:userActivity];
当 App 通过 URI Scheme 深度链接或 Universal Link 启用时,请在调用的函数中调用 Airbridge.trackDeeplink
函数。Airbridge.trackDeeplink
函数将深度链接传递给 Airbridge SDK。
import SwiftUI
import Airbridge
@main
struct ActualApp: App {
var body: some Scene {
WindowGroup {
ContentView()
// when app is opened with scheme deeplink or universal links
.onOpenURL { url in
// track deeplink
Airbridge.trackDeeplink(url: url)
}
}
}
}
为确保将用户发送到目标页面,必须使用 Airbridge.handleDeeplink
函数将 Airbridge 深度链接转换为 URI Scheme 深度链接。
import Airbridge
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
#import <Airbridge/Airbridge.h>
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
Airbridge.handleDeeplink
函数在输入 Airbridge 深度链接时,会返回 true
并通过回调提供 URI Scheme 深度链接。如果不是 Airbridge 深度链接,则返回 false
,且不提供回调。利用此功能,可以分开处理通过 Airbridge 启用的深度链接。
在通过深度链接启用的 App 调用的 OS 回调中,将 Airbridge.handleDeeplink
函数放置在 Airbridge.trackDeeplink
函数的正下方调用。如有必要,应将现有逻辑一并处理。
当 App 通过 URI Scheme 深度链接或 Universal Link 启用时,请在调用的函数中调用 Airbridge.handleDeeplink
函数。转换后的 URI Scheme 深度链接将用户发送到预设的目标页面。
import SwiftUI
import Airbridge
@main
struct ActualApp: App {
var body: some Scene {
WindowGroup {
ContentView()
// when app is opened with scheme deeplink or universal links
.onOpenURL { url in
// track deeplink
Airbridge.trackDeeplink(url: url)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
}
}
}
请进行设置启用以下功能:
使用 Airbridge 深度链接启用 App
在 App 收集 Airbridge 深度链接事件
使用 Airbridge 深度链接实现用户跳转
当用户点击追踪链接时,App 应通过 Airbridge 深度链接启用。
1. 需要在 App 进行 Airbridge 深度链接的 URI Scheme 深度链接设置。请在 Xcode 中导航至 [YOUR_PROJECT]>[Info]>[URL Types]。
2. 请点击 “+”,并在 URL Schemes 中输入已在 Airbridge 面板中注册的 iOS URI Scheme。
注意
必须输入不包括
://
的 iOS URI Scheme。
3. 需要在 App 进行 Airbridge 深度链接的 Universal Link 设置。请在 Xcode 中导航至 [YOUR_PROJECT]>[Signing & Capabilities]。
4. 请点击 “+ Capability” 以添加 Associated Domains。
5. 请将 applinks:YOUR_APP_NAME.airbridge.io
和 applinks:YOUR_APP_NAME.abr.ge
添加到 Associated Domains。YOUR_APP_NAME
是 Airbridge App 名称。
注意
如果您正在使用或计划使用 Password AutoFill 功能,则必须添加 Webcredentials 域名。否则用户可能会看到通过 Password AutoFill 功能保存的密码域名显示为 airbridge.io 或 abr.ge。
更多信息请参阅 本指南。
注意
在 iOS,无法自动收集深度链接事件。必须使用
Airbridge.trackDeeplink
函数将深度链接事件传递给 Airbridge SDK。
为了收集深度链接事件,必须将深度链接事件传递给 Airbridge SDK。当 App 通过深度链接启用时,请在调用的 OS 回调顶部调用 Airbridge.trackDeeplink
函数。
import Airbridge
...
Airbridge.trackDeeplink(url: url)
Airbridge.trackDeeplink(userActivity: userActivity)
#import <Airbridge/Airbridge.h>
...
[Airbridge trackDeeplinkWithUrl:url];
[Airbridge trackDeeplinkWithUserActivity:userActivity];
具体设置方法因 Airbridge 深度链接类型而异。
1. 当 App 通过 URI Scheme 深度链接启用时,请在调用的函数中调用 Airbridge.trackDeeplink
函数。
import Airbridge
...
// when app is opened with scheme deeplink
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
// track deeplink
Airbridge.trackDeeplink(url: url)
return true
}
#import <Airbridge/Airbridge.h>
...
// when app is opened with scheme deeplink
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
return YES;
}
2. 当 App 通过 Universal Link 启用时,请在调用的函数中调用 Airbridge.trackDeeplink
函数。
// when app is opened with universal links
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
return true
}
#import <Airbridge/Airbridge.h>
...
// when app is opened with universal links
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
return YES;
}
为确保将用户发送到目标页面,必须使用 Airbridge.handleDeeplink
函数将 Airbridge 深度链接转换为 URI Scheme 深度链接。
import Airbridge
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
#import <Airbridge/Airbridge.h>
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
Airbridge.handleDeeplink
函数在输入 Airbridge 深度链接时,会返回 true
并通过回调提供 URI Scheme 深度链接。如果不是 Airbridge 深度链接,则返回 false
,且不提供回调。利用此功能,可以分开处理通过 Airbridge 启用的深度链接。
根据系统方式和 App 状态,在通过深度链接启用的 App 调用的 OS 回调中,将 Airbridge.handleDeeplink
函数放置在 Airbridge.trackDeeplink
函数的正下方调用。如有必要,应将现有逻辑一并处理。
1. 请在 AppDelegate 中实现用于处理通过 Airbridge 深度链接启用的 App 的函数。
import Foundation
...
// when app is opened with airbridge deeplink
func handleAirbridgeDeeplink(url: URL) {
// show proper content using url (YOUR_SCHEME://...)
}
import Foundation
...
// when app is opened with airbridge deeplink
- (void)handleAirbridgeDeeplink:(NSURL *)url {
// show proper content using url (YOUR_SCHEME://...)
}
2. 当 App 通过 URI Scheme 深度链接启用时,请在调用的函数中调用 Airbridge.handleDeeplink
函数。转换后的 URI Scheme 深度链接将用户发送到预设的目标页面。
import Airbridge
...
// when app is opened with scheme deeplink
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
// track deeplink
Airbridge.trackDeeplink(url: url)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
return isHandled
}
#import <Airbridge/Airbridge.h>
...
// when app is opened with scheme deeplink
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
return isHandled;
}
3. 当 App 通过 Universal Link 启用时,请在调用的函数中调用 Airbridge.handleDeeplink
函数。转换后的 URI Scheme 深度链接将用户发送到预设的目标页面。
// when app is opened with universal links
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
return isHandled
}
#import <Airbridge/Airbridge.h>
...
// when app is opened with universal links
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
return isHandled;
}
When a user clicks on a tracking link with deferred deep linking capabilities and your app is not installed on the device, the Airbridge SDK collects the deep link as follows.
Airbridge SDK 在初始化以后,如果满足以下所有条件,会尝试获取深度链接。如果在获取深度链接的过程中 App 被关闭,Airbridge SDK 会将视为没有保存的深度链接。
已设置 Opt-in 时调用 Airbridge.startTracking
函数;或未设置 Opt-in。
用户在 ATT 弹窗中做出选择,或 ATT 弹窗中设置的事件收集延迟时间已到期。
The Airbridge.handleDeferredDeeplink
function retrieves the saved Airbridge deep link and converts it into a scheme deep link to pass it to the app. Users are redirected to the intended destination using the converted scheme deep link.
import Airbridge
...
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
...
let isHandled = Airbridge.handleDeferredDeeplink() { url in
if let url {
// show proper content using url (YOUR_SCHEME://...)
}
}
#import <Airbridge/Airbridge.h>
...
AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
token:@"YOUR_APP_SDK_TOKEN"];
AirbridgeOption* option = [optionBuilder build];
[Airbridge initializeSDKWithOption:option];
...
BOOL isHandled = [Airbridge handleDeferredDeeplinkOnSuccess:^(NSURL* url) {
if (url != nil) {
// show proper content using url (YOUR_SCHEME://...)
}
}];
The Airbridge.handleDeferredDeeplink
function returns true
if the app is installed and called for the first time, waits for the Airbridge deep link acquisition, and converts it to a scheme deep link to pass it to onSuccess
. You can use this scheme deep link to send users to the set destination.
If there is no stored Airbridge deep link, it will deliver nil
to onSuccess
. If the SDK is not initialized or if the Airbridge.handleDeferredDeeplink
function has not been called for the first time, it will return false
.
The scheme deep link delivered is generally in the format of YOUR_SCHEME://...
URL. If you use services like Meta Deferred App Links, it may be delivers in a different format.
The SDK functionality test and deep link test allow you to check whether the SDK and deep linking work as intended.
Check whether the Airbridge iOS SDK is operating properly. The Install events are collected by the Android SDK regardless of whether the additional configurations have been completed or not.
Follow the steps below to check whether the Install events are being collected by the iOS SDK.
1. Prepare a test device where the app is not installed, or if the app is already installed, delete it before testing.
2. Set the SDK log level to Log_ALL
.
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
3. Install the app on the test device. After installing the app, launch it so that the Install event is collected.
The first Open event collected by Airbridge is recorded as an Install event. Therefore, the Open may not be recorded when the app install event is collected.
4. In the Xcode Console, check whether the event performed on the test device with a specific IDFA is logged properly. In the Console Filter, enter Library:Airbridge
. If the Install events are being collected properly, you should see logs such as the following.
Send event packets to Airbridge: categories=9161
Send event packets to Airbridge: categories=9163
For the Xcode Console messages and their meaning, refer to the following.
Event packet is stored in storage: categories={event_category}
: The event category is stored.
Send event packets to Airbridge: categories={event_category}
: Sending the event category.
Client receive response: method=post url=https://event-track.airbridge.io/v1/apps/{app_name}
: Sent the event category successfully through the network.
5. If you can't see the logs in the Xcode Console even after a sufficient amount of time has passed, check whether the SDK has been initialized, the SDK configurations are completed as instructed, and the network status is stable.
If the problem persists, contact your Airbridge CSM and share your SDK logs. If you don't have a designated Airbridge CSM, contact the Airbridge Help Center.
Check whether the deep linking feature configured in the Airbridge iOS SDK works as intended.
Before testing the deep link, make sure the following items have been set up.
Item |
Description |
Resources |
---|---|---|
HTTP Deep Link (App links) | Setup is required | |
Scheme Deep Link | Setup is required | |
Deferred Deep Link | The setup is completed automatically. No additional setup is required. | |
Custom Domain | Setup is optional | |
App Install | - If you don't need to test the deferred deep link, install the app on your test device in advance. - If you need to test the deferred deep link, the app should not be installed on the test device. If the app is installed, delete the app from the test device. |
Airbridge provides a website for testing deep links. If you want to test deferred deep links, you need to uninstall the app from your test device.
1. Visit the deep link testing site from your test device. You can access the website directly by using the QR code below.
2. Enter the App Name you registered with Airbridge. You can find it on the [Settings]>[Tokens] page in the Airbridge dashboard.
If you want to test a specific deep link address, enter the scheme deep link into the Deeplink URL field. The scheme deep link format is {YOUR_SCHEME}://...
If you're using a custom domain, make sure to enter your custom domain.
3. Click one of the buttons listed below. Click the button depending on the deep link type you are testing.
Note that you can only test deferred deep links if the app is not installed on your test device.
Button |
Description |
Example |
---|---|---|
Test HTTP Deeplink Type-1 | Test the HTTP deep link in the format of |
|
Test HTTP Deeplink Type-2 | Test the HTTP deep link in the format of |
|
Test Scheme Deeplink | Test the scheme deep link. |
|
Test Deferred Deeplink | Test the deferred deep link. |
|
Test Custom Domain Deeplink | Test the custom domain. This button is only available when the custom domain is entered. |
|
4. Check whether the event performed on the test device with a specific IDFA is logged properly in the Xcode Console. Enter [Airbridge][Debug]
in the Console filter. If the Install events are being collected properly, you should see logs as follows.
[Airbridge] [Debug] - success network to url: https://core.airbridge.io/api/v4/apps/{app_name
}
/events/mobile-app/9162
[Airbridge] [Debug] - success network to url : https://core.airbridge.io/api/v4/apps/{app_name
}
/events/mobile-app/9163
[Airbridge] [Debug] - success network to url : https://core.airbridge.io/api/v4/apps/{app_name
}
/events/mobile-app/9168
If the SDK log level has been set to DEBUG
in the Airbridge SDK initialization process, you can check the value sent through the network.
5. The client request: method={...} message transmits the header and body values. Check the following items based on the button clicked on the deep link test site. If the deep link is working properly, all items should be confirmed.
如果点击了 Test HTTP Deeplink Type-1,请在 SDK 日志检查:
eventData.deeplink
应为 https://{YOUR_APP_NAME}.abr.ge...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
如果点击了 Test HTTP Deeplink Type-2,请在 SDK 日志检查:
eventData.deeplink
应为 https://{YOUR_APP_NAME}.airbridge.io...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
如果点击了 Test Scheme Deeplink,请在 SDK 日志检查:
eventData.deeplink
应为 {YOUR_SCHEME}://main...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
如果点击了 Test Deferred Deeplink,请在 SDK 检查:
eventData.deeplink
应为 {YOUR_SCHEME}://main...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
如果点击了 Test Custom Domain Deeplink,请在 SDK 日志检查:
eventData.deeplink
应为 https://{YOUR_CUSTOM_DOMAIN}...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
Refer to the information below for troubleshooting regarding deep links.
Problem | Solution |
---|---|
You clicked a deep link, but the app was not launched. Or the SDK logs show information that is not intended as per setting. | Check whether the deep link is set up correctly. Refer to this article for the deep linking setup. |
You clicked a deep link, and the app was launched, but you didn't land on the intended app page. | You need to write code that redirects the user to the deep link path that is passed by the |
Was this page helpful?
#import "AppDelegate.h"
#import <Airbridge/Airbridge.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
token:@"YOUR_APP_SDK_TOKEN"];
AirbridgeOption* option = [optionBuilder build];
[Airbridge initializeSDKWithOption:option];
return YES;
}
@end
import SwiftUI
import Airbridge
@main
struct ExampleApp: App {
init() {
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
import ProjectDescription
let project = Project(
targets: [
.target(
infoPlist: .extendingDefault(
with: [
"NSUserTrackingUsageDescription": "YOUR_DESCRIPTION",
...
]
),
...
),
...
]
...
)
import AppTrackingTransparency
...
ATTrackingManager.requestTrackingAuthorization { _ in }
#import <AppTrackingTransparency/AppTrackingTransparency.h>
...
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {}];
import Airbridge
import AppTrackingTransparency
...
var observer: Any?
...
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
...
observer = NotificationCenter.default.addObserver(
forName: UIApplication.didBecomeActiveNotification,
object: nil,
queue: nil
) { [weak self] _ in
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { _ in }
}
if let observer = self?.observer {
NotificationCenter.default.removeObserver(observer)
}
}
#import <Airbridge/Airbridge.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>
...
id observer;
...
AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
token:@"YOUR_APP_SDK_TOKEN"];
[optionBuilder setAutoDetermineTrackingAuthorizationEnabled:NO];
AirbridgeOption* option = [optionBuilder build];
[Airbridge initializeSDKWithOption:option];
...
__weak typeof(self) weakSelf = self;
observer = [NSNotificationCenter.defaultCenter addObserverForName:UIApplicationDidBecomeActiveNotification
object:nil
queue:nil
usingBlock:^(NSNotification * _Nonnull notification) {
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {}];
}
if (weakSelf != nil && weakSelf->observer != nil) {
[NSNotificationCenter.defaultCenter removeObserver:observer];
}
}];
import SwiftUI
import Airbridge
import AppTrackingTransparency
@main
struct ExampleApp: App {
var observer: Any?
init() {
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
observer = NotificationCenter.default.addObserver(
forName: UIApplication.didBecomeActiveNotification,
object: nil,
queue: nil
) { [weak self] _ in
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { _ in }
}
if let observer = self?.observer {
NotificationCenter.default.removeObserver(observer)
}
}
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
import Airbridge
...
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME",
token: "YOUR_APP_SDK_TOKEN")
.setAutoDetermineTrackingAuthorizationTimeout(second: 30)
.build()
Airbridge.initializeSDK(option: option)
#import <Airbridge/Airbridge.h>
...
AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
token:@"YOUR_APP_SDK_TOKEN"];
[optionBuilder setAutoDetermineTrackingAuthorizationTimeoutWithSecond:30];
AirbridgeOption* option = [optionBuilder build];
[Airbridge initializeSDKWithOption:option];
import Airbridge
...
Airbridge.trackDeeplink(url: url)
Airbridge.trackDeeplink(userActivity: userActivity)
import Airbridge
...
Airbridge.trackDeeplink(url: url)
Airbridge.trackDeeplink(userActivity: userActivity)
import Airbridge
...
Airbridge.trackDeeplink(url: url)
Airbridge.trackDeeplink(userActivity: userActivity)
#import <Airbridge/Airbridge.h>
...
[Airbridge trackDeeplinkWithUrl:url];
[Airbridge trackDeeplinkWithUserActivity:userActivity];
#import <Airbridge/Airbridge.h>
...
[Airbridge trackDeeplinkWithUrl:url];
[Airbridge trackDeeplinkWithUserActivity:userActivity];
#import <Airbridge/Airbridge.h>
...
[Airbridge trackDeeplinkWithUrl:url];
[Airbridge trackDeeplinkWithUserActivity:userActivity];
import Airbridge
...
// when terminated app is opened with scheme deeplink or universal links
func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
// when app is opened with scheme deeplink
if let url = connectionOptions.urlContexts.first?.url {
// track deeplink
Airbridge.trackDeeplink(url: url)
}
// when app is opened with universal links
else if let userActivity = connectionOptions.userActivities.first {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
}
}
#import <Airbridge/Airbridge.h>
...
// when terminated app is opened with scheme deeplink or universal links
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// when app is opened with scheme deeplink
NSURL* url = connectionOptions.URLContexts.allObjects.firstObject.URL;
NSUserActivity* userActivity = connectionOptions.userActivities.allObjects.firstObject;
if (url != nil) {
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
}
else if (userActivity != nil) {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
}
}
import Airbridge
...
// when backgrounded app is opened with scheme deeplink
func scene(
_ scene: UIScene,
openURLContexts URLContexts: Set<UIOpenURLContext>
) {
guard let url = URLContexts.first?.url else { return }
// track deeplink
Airbridge.trackDeeplink(url: url)
}
#import <Airbridge/Airbridge.h>
...
// when backgrounded app is opened with scheme deeplink
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
NSURL* url = URLContexts.allObjects.firstObject.URL;
if (url == nil) { return; }
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
}
import Airbridge
...
// when backgrounded app is opened with universal links
func scene(
_ scene: UIScene,
continue userActivity: NSUserActivity
) {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
}
// when backgrounded app is opened with universal links
- (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
}
import Airbridge
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
import Airbridge
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
import Airbridge
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
#import <Airbridge/Airbridge.h>
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
#import <Airbridge/Airbridge.h>
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
#import <Airbridge/Airbridge.h>
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
...
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
import Foundation
...
// when app is opened with airbridge deeplink
func handleAirbridgeDeeplink(url: URL) {
// show proper content using url (YOUR_SCHEME://...)
}
import Foundation
...
// when app is opened with airbridge deeplink
func handleAirbridgeDeeplink(url: URL) {
// show proper content using url (YOUR_SCHEME://...)
}
import Foundation
...
// when app is opened with airbridge deeplink
- (void)handleAirbridgeDeeplink:(NSURL *)url {
// show proper content using url (YOUR_SCHEME://...)
}
import Foundation
...
// when app is opened with airbridge deeplink
- (void)handleAirbridgeDeeplink:(NSURL *)url {
// show proper content using url (YOUR_SCHEME://...)
}
import Airbridge
...
// when terminated app is opened with scheme deeplink or universal links
func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
// when app is opened with scheme deeplink
if let url = connectionOptions.urlContexts.first?.url {
// track deeplink
Airbridge.trackDeeplink(url: url)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
// when app is opened with universal links
else if let userActivity = connectionOptions.userActivities.first {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
}
#import <Airbridge/Airbridge.h>
...
// when terminated app is opened with scheme deeplink or universal links
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// when app is opened with scheme deeplink
NSURL* url = connectionOptions.URLContexts.allObjects.firstObject.URL;
NSUserActivity* userActivity = connectionOptions.userActivities.allObjects.firstObject;
if (url != nil) {
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
}
else if (userActivity != nil) {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
}
}
import Airbridge
...
// when backgrounded app is opened with scheme deeplink
func scene(
_ scene: UIScene,
openURLContexts URLContexts: Set<UIOpenURLContext>
) {
guard let url = URLContexts.first?.url else { return }
// track deeplink
Airbridge.trackDeeplink(url: url)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
#import <Airbridge/Airbridge.h>
...
// when backgrounded app is opened with scheme deeplink
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
NSURL* url = URLContexts.allObjects.firstObject.URL;
if (url == nil) { return; }
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
}
// when backgrounded app is opened with universal links
- (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
}
import Airbridge
...
// when backgrounded app is opened with universal links
func scene(
_ scene: UIScene,
continue userActivity: NSUserActivity
) {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
import SwiftUI
import Airbridge
@main
struct ActualApp: App {
var body: some Scene {
WindowGroup {
ContentView()
// when app is opened with scheme deeplink or universal links
.onOpenURL { url in
// track deeplink
Airbridge.trackDeeplink(url: url)
}
}
}
}
import SwiftUI
import Airbridge
@main
struct ActualApp: App {
var body: some Scene {
WindowGroup {
ContentView()
// when app is opened with scheme deeplink or universal links
.onOpenURL { url in
// track deeplink
Airbridge.trackDeeplink(url: url)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
}
}
}
}
import Airbridge
...
// when app is opened with scheme deeplink
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
// track deeplink
Airbridge.trackDeeplink(url: url)
return true
}
#import <Airbridge/Airbridge.h>
...
// when app is opened with scheme deeplink
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
return YES;
}
// when app is opened with universal links
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
return true
}
#import <Airbridge/Airbridge.h>
...
// when app is opened with universal links
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
return YES;
}
import Airbridge
...
// when app is opened with scheme deeplink
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
// track deeplink
Airbridge.trackDeeplink(url: url)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(url: url) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
return isHandled
}
#import <Airbridge/Airbridge.h>
...
// when app is opened with scheme deeplink
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
// track deeplink
[Airbridge trackDeeplinkWithUrl:url];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUrl:url onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
return isHandled;
}
// when app is opened with universal links
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
// track deeplink
Airbridge.trackDeeplink(userActivity: userActivity)
// handle deeplink
var isHandled = Airbridge.handleDeeplink(userActivity: userActivity) { url in
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
handleAirbridgeDeeplink(url: url)
}
if isHandled { return }
// when app is opened with other deeplink
// use existing logic as it is
return isHandled
}
#import <Airbridge/Airbridge.h>
...
// when app is opened with universal links
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
// track deeplink
[Airbridge trackDeeplinkWithUserActivity:userActivity];
// handle deeplink
BOOL isHandled = [Airbridge handleDeeplinkWithUserActivity:userActivity onSuccess:^(NSURL* url) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
[self handleAirbridgeDeeplink:url];
}];
if (isHandled) { return; }
// when app is opened with other deeplink
// use existing logic as it is
return isHandled;
}
import Airbridge
...
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)
...
let isHandled = Airbridge.handleDeferredDeeplink() { url in
if let url {
// show proper content using url (YOUR_SCHEME://...)
}
}
#import <Airbridge/Airbridge.h>
...
AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
token:@"YOUR_APP_SDK_TOKEN"];
AirbridgeOption* option = [optionBuilder build];
[Airbridge initializeSDKWithOption:option];
...
BOOL isHandled = [Airbridge handleDeferredDeeplinkOnSuccess:^(NSURL* url) {
if (url != nil) {
// show proper content using url (YOUR_SCHEME://...)
}
}];
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
.build()
Airbridge.initializeSDK(option: option)