SDK Installation


Package Installation

Cocoapods

  1. Create Podfile file with below commands.
cd path/to/project
touch Podfile
  1. Fill in the contents of the Podfile file like below.
target '[Project name]' do
    pod 'AirBridge', '1.17.0'
end
  1. Open terminal and enter the following command.
cd path/to/project
pod install --repo-update

When there are no pod command, install cocoapods with below command.
sudo gem install cocoapods

Direct install

AirBridge.framework : Download

  1. Download AirBridge.framework file and add to Xcode > Project file > General > Frameworks, Libraries, and Embedded Content.
  2. Add 5 frameworks of below to project.
1. Xcode > Project file > General > Frameworks, Libraries, and Embedded Content.
2. Click `+` button and click `[Framework name].framework`.
3. Click `Add` button.

Framework

Description

AdSupport.framework

Used to collect IDFA.

iAd.framework

Used to collect Apple search ads attribution.

CoreTelephony.framework

Used to collect carrier information.

StoreKit.framework

Used to collect SKAdNetwork information.

AppTrackingTransparency.framework

Used to collect tracking authorization status.

Project Setup

Initialization

Initialize SDK by adding following code to top of application:didFinishLaunchingWithOptions: method in AppDelegate file.

#import <AirBridge/AirBridge.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
    [AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
    ...
}
import AirBridge

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)
    ...
}

YOUR_APP_NAME can be found on the dashboard at Settings > Tokens > App Name.
YOUR_APP_TOKEN can be found on the dashboard at Settings > Tokens > App SDK Token.

Accept IDFA terms and conditions

To use SDK, IDFA terms and conditions is be agreed when post application to the App Store.

  1. Check the 'Yes' item.
  2. The screen as shown below will be displayed.
  3. Check the 'Attribute this app Install to a previously served advertisement' item.
  4. Check the 'Attribute an action taken within this app to a previously served advertisement' item.
  5. Check the 'Limit Ad Tracking Setting in iOS' item.

Testing

Check install event is sent when install and run application.

Check with dashboard

Events from SDK are shown on Airbridge Dashboard > Raw Data > App Real-time Logs.

  1. Move to Airbridge Dashboard > Raw Data > App Real-time Logs.
  2. Insert iOS IDFA to Search.

Can be delayed by up to 5 minutes.

Check with log

When insert following code at the top of code that initialize SDK, SDK log is printed.

[AirBridge setLogLevel:AB_LOG_ALL];
[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
AirBridge.setLogLevel(.LOG_ALL)
AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)

Deep Link Setup


Dashboard Setup

2 informations is needed on Airbridge Dashboard > Tracking Link > Deep Link.

  • iOS URI Scheme
  • iOS App ID

iOS URI Scheme

Enter the desired scheme by attaching :// to the iOS URI Scheme area of Airbridge dashboard.

Example) example://

iOS App ID

  1. Move to Identifiers of https://developer.apple.com/account/resources.
  2. Click identifier of application which want to track.
  3. Insert App ID Prefix + . + Bundle ID

Example) 9JA89QQLNQ.com.apple.wwdc

Project Setup

Scheme

  1. Move to Xcode > Project file > Info > URL Types.
  2. Insert iOS URI Scheme of Airbridge dashboard to URL Schemes.

Remove :// and insert it.

Universal Link

  1. Move to Xcode > Project file > Signing & Capabilities.
  2. Click + Capability and add Associated Domains.
  3. Add applinks:YOUR_APP_NAME.airbridge.io to Associated Domains.
  4. Add applinks:YOUR_APP_NAME.deeplink.page to Associated Domains.

YOUR_APP_NAME can be found on the dashboard at Settings > Tokens > App Name.

When use Autofill feature, check out Troubleshooting > Webcredentials.

Send deeplink information to SDK

  1. Open ios/[Project name]/AppDelegate file.
  2. Call handleURLSchemeDeeplink method at the top of below method to send deeplink information to SDK when application is opened by scheme.
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
{
    [AirBridge.deeplink handleURLSchemeDeeplink:url];

    return YES;
}
func application(_ app: UIApplication,
                 open url: URL,
                 options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool
{
    AirBridge.deeplink()?.handleURLSchemeDeeplink(url)
    
    return true
}
  1. If target iOS 8.x or earlier, call handleURLSchemeDeeplink method at the top of below method to send deeplink information to SDK when application is opened by scheme.
- (BOOL)application:(UIApplication*)application
            openURL:(NSURL*)url
  sourceApplication:(NSString*)sourceApplication 
         annotation:(id)annotation
{
    [AirBridge.deeplink handleURLSchemeDeeplink:url];

    return YES;
}
func application(_ application: UIApplication,
                 open url: URL,
                 sourceApplication: String?,
                 annotation: Any) -> Bool
{
    AirBridge.deeplink()?.handleURLSchemeDeeplink(url)
    
    return true;
}
  1. Call handleUniversalLink method at the top of below method to send deeplink information to SDK when application is opened by Universal Link.
-  (BOOL)application:(UIApplication*)application
continueUserActivity:(NSUserActivity*)userActivity
  restorationHandler:(void (^)(NSArray* _Nullable))restorationHandler
{
    [AirBridge.deeplink handleUniversalLink:userActivity.webpageURL];

    return YES;
}
func application(_ application: UIApplication,
                 continue userActivity: NSUserActivity,
                 restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
{
    if let webpageURL = userActivity.webpageURL {      
        AirBridge.deeplink()?.handleUniversalLink(webpageURL)
    }
    
    return true
}

Deeplink callback setting

  1. Open ios/[Project file]/AppDelegate file.
  2. Call setDeeplinkCallback
  3. Call setDeepCallback method to insert callback that will be called when application is opened with deeplink.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
    [AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

    [AirBridge.deeplink setDeeplinkCallback:^(NSString* deeplink) {
        // Deeplink from airbridge = YOUR_SCHEME://...
        NSLog(@"DeeplinkCallback : %@", deeplink);
    }];
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey:
Any]?) -> Bool {
    AirBridge.getInstance("YOUR_APP_TOKEN", appName: "YOUR_APP_NAME", withLaunchOptions: launchOptions)
    
    AirBridge.deeplink()?.setDeeplinkCallback({ (deeplink) in
        // 딥링크로 앱이 열리는 경우 작동할 코드
        // Airbridge 를 통한 Deeplink = YOUR_SCHEME://...
        NSLog("DeeplinkCallback : %@", deeplink)
    })
    
    return true
}

All of deeplinks are sent to Deeplink callback
And deeplink from airbridge of deeplinks is sent to DeeplinkCallback with YOUR_SCHEME://... form.

Deferred deeplink is delivered to callback when ATT status is selected or timeout alerted.
Deferred deeplink has deferred=true value on query parameter.


When use Airbridge iOS SDK, 1.10.0 ~ 1.10.9
Airbridge deeplink is in https://YOUR_APP_NAME.airbridge.io/... form.

When use Airbridge iOS SDK, ~ 1.9.10
Airbridge deeplink is in https://YOUR_APP_NAME.airbridge.io/... or YOUR_SCHEME://... form.

Custom domain setting (option)

When use custom domain on airbridge tracking link, following setting is needed. (replace example.com with custom domain)

  1. Move to Xcode > Project file > Signing & Capabilities > Associated Domains.
  2. Click + button and add applinks:example.com.
  3. Open info.plist file.
  4. Add following value.

Testing

Check application is opened and deeplink event is sent when click deeplink that in YOUR_SCHEME://... form.

Example) example://

  1. Click deeplink.
  2. Check deeplink event is exist on Airbridge dashboard > Raw Data > App Real-time Logs

User Setup


User Identifier Setup

Insert user identifier to SDK, then SDK insert user identifier to all of tracked events.

[AirBridge.state setUserID:@"testID"];
[AirBridge.state setUserEmail:@"[email protected]"];
[AirBridge.state setUserPhone:@"000-0000-0000"];

// user attributes changed with inserted dictionary.
[AirBridge.state setUserAttributes:@{@"key": @"value"}];
// key, value is inserted to existed user attributes.
[AirBridge.state addUserAttributesWithKey:@"key" value:@"value"];

// user alias changed with inserted dictionary.
[AirBridge.state setUserAlias:@{@"key": @"value"}];
// key, value is inserted to existed user alias.
[AirBridge.state addUserAliasWithKey:@"key" value:@"value"];
AirBridge.state()?.setUserID("testID")
AirBridge.state()?.setUserEmail("[email protected]")
AirBridge.state()?.setUserPhone("000-0000-0000")

// 입력된 dictionary 로 user attributes 가 교체됩니다.
AirBridge.state()?.setUserAttributes(["key": "value" as NSObject])
// 기존의 user attributes 에 해당 key, value 가 추가됩니다.
AirBridge.state()?.addUserAttributes(withKey: "key", value: "value" as NSObject)

// 입력된 dictionary 로 user alias 가 교체됩니다.
AirBridge.state()?.setUserAlias(["key": "value"])
// 기존의 user alias 에 해당 key, value 가 추가됩니다.
AirBridge.state()?.addUserAlias(withKey: "key", value: "value")

Name

Description

Limit

id

User ID

email

User Email

Automatically hashed by SHA256
(Can be disabled)

phone

User phone number

Automatically hashed by SHA256
(Can be disabled)

attributes

User attributes

  • Maximum 100
  • key is NSString type, maximum 128
  • key must satisfy ^[a-z_][a-z0-9_]*$ expression
  • value is NSString or NSNumber type
  • when value is NSString type, maximum 1024

alias

Another User ID

  • Maximum 100
  • key is NSString type, maximum 128
  • key must satisfy ^[a-z_][a-z0-9_]*$ expression
  • value is NSString type, maximum 1024

Testing

After user setting, check event has user information when send event with SDK.

  1. Insert user identifier to SDK.
  2. Send event with SDK.
  3. Click the event on Airbridge dashboard > Raw Data > App Real-time Logs and check user information in JSON.

Event Setup


When important user actions occur, in-app events can be sent to measure performance by channel.

All parameters of event are optional.
However, adding more information to events help providing more accurate statistics.

Custom Event

Send custom event with SDK.

setCategory method must be called to send event.

#import <AirBridge/ABInAppEvent.h>

ABInAppEvent* event = [[ABInAppEvent alloc] init];

[event setCategory:@"category"];
[event setAction:@"action"];
[event setLabel:@"label"];
[event setValue:@(123)];
[event setCustoms:@{@"key": @"value"}];

ABSemanticAttributes* semanticAttributes = [[ABSemanticAttributes alloc] init];
semanticAttributes.transactionID = @"transaction_123";
[event setSemanticAttributes:semanticAttributes];

[event send];
let event = ABInAppEvent()

event?.setCategory("category")
event?.setAction("action")
event?.setLabel("label")
event?.setValue(123)
event?.setCustoms(["key": "value"])

// Semantic Attributes Option 1
let semanticAttributes = ABSemanticAttributes()
semanticAttributes?.transactionID = "transaction_123"
event?.setSemanticAttributes(semanticAttributes)

// Semantic Attributes Option 2
// For more details, please check following page
// https://developers.airbridge.io/docs/event-structure#semantic-attributes
event?.setSemantics(["transactionID": "transaction_123"])

event?.send()

Parameter

Description

setCategory

Event name (required)

setAction

Event group 1

setLabel

Event group 2

setValue

Event custom value

setCustoms

Event custom information

setSemanticAttributes

Event semantic information

User Event

Send user event with SDK.

setAction, setLabel, setValue, setCustoms, setSemantics, setSemanticAttributes methods are also can be used on user event.

Sign up

When send sign up event, user identifier are set by inserted value.

#import <AirBridge/ABUser.h>
#import <AirBridge/ABUserEvent.h>

ABUser* user = [[ABUser alloc] init];
user.ID = @"testID";
user.email = @"[email protected]";
user.phone = @"000-0000-0000";
user.alias = @{
    @"key": @"value",
};
user.attributes = @{
    @"key": @"value",
};

ABUserEvent* event = [[ABUserEvent alloc] initWithUser:user];
[event sendSignup];
let user = ABUser()
user.ID = "testID"
user.email = "[email protected]"
user.phone = "000-0000-0000"
user.attributes = [
    "key": "value" as NSObject,
]
user.alias = [
    "key": "value",
]

let event = ABUserEvent(user: user)
event?.sendSignup()

Sign in

When send sign in event, user identifier are set by inserted value.

#import <AirBridge/ABUser.h>
#import <AirBridge/ABUserEvent.h>

ABUser* user = [[ABUser alloc] init];
user.ID = @"testID";
user.email = @"[email protected]";
user.phone = @"000-0000-0000";
user.alias = @{
    @"key": @"value",
};
user.attributes = @{
    @"key": @"value",
};

ABUserEvent* event = [[ABUserEvent alloc] initWithUser:user];
[event sendSignin];
let user = ABUser()
user.ID = "testID"
user.email = "[email protected]"
user.phone = "000-0000-0000"
user.attributes = [
    "key": "value" as NSObject,
]
user.alias = [
    "key": "value",
]

let event = ABUserEvent(user: user)
event?.sendSignin()

Sign out

When send sign out event, user identifier are initialized.

#import <AirBridge/ABUserEvent.h>

ABUserEvent* event = [[ABUserEvent alloc] init];
[event expireUser];
let event = ABUserEvent()
event?.expireUser()

E-Commerce Event

Send ecommerce event with SDK.

setAction, setLabel, setValue, setCustoms, setSemantics, setSemanticAttributes methods are also can be used on ecommerce event.

View home screen

#import <AirBridge/ABEcommerceEvent.h>

ABEcommerceEvent* event = [[ABEcommerceEvent alloc] init];

[event sendViewHome];
let event = ABEcommerceEvent()

event?.sendViewHome()

View product detail

#import <AirBridge/ABProduct.h>
#import <AirBridge/ABEcommerceEvent.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABEcommerceEvent* event = [[ABEcommerceEvent alloc] initWithProducts:@[product1]];

[event sendViewProductDetail];
let product1 = ABProduct()
product1.idx = "idx1"
product1.name = "name1"
product1.price = 100
product1.currency = "USD"
product1.orderPosition = 1
product1.quantity = 1

let event = ABEcommerceEvent(products: [product1])

event?.sendViewProductDetail()

View product list

#import <AirBridge/ABProduct.h>
#import <AirBridge/ABEcommerceEvent.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABProduct* product2 = [[ABProduct alloc] init];
product2.idx = @"idx2";
product2.name = @"name2";
product2.price = @200;
product2.currency = @"USD";
product2.orderPosition = @2;
product2.quantity = @2;

ABEcommerceEvent* event = [[ABEcommerceEvent alloc] initWithProducts:@[product1, product2]];
event.productListID = @"listID";

[event sendViewProductList];
let product1 = ABProduct()
product1.idx = "idx1"
product1.name = "name1"
product1.price = 100
product1.currency = "USD"
product1.orderPosition = 1
product1.quantity = 1

let product2 = ABProduct()
product2.idx = "idx2"
product2.name = "name2"
product2.price = 200
product2.currency = "USD"
product2.orderPosition = 2
product2.quantity = 2

let event = ABEcommerceEvent(products: [product1, product2])
event?.productListID = "listID"

event?.sendViewProductList()

View search result

#import <AirBridge/ABProduct.h>
#import <AirBridge/ABEcommerceEvent.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABProduct* product2 = [[ABProduct alloc] init];
product2.idx = @"idx2";
product2.name = @"name2";
product2.price = @200;
product2.currency = @"USD";
product2.orderPosition = @2;
product2.quantity = @2;

ABEcommerceEvent* event = [[ABEcommerceEvent alloc] initWithProducts:@[product1, product2]];
event.query = @"query";

[event sendViewSearchResult];
let product1 = ABProduct()
product1.idx = "idx1"
product1.name = "name1"
product1.price = 100
product1.currency = "USD"
product1.orderPosition = 1
product1.quantity = 1

let product2 = ABProduct()
product2.idx = "idx2"
product2.name = "name2"
product2.price = 200
product2.currency = "USD"
product2.orderPosition = 2
product2.quantity = 2

let event = ABEcommerceEvent(products: [product1, product2])
event?.query = "query"

event?.sendViewSearchResult()

Add to cart

#import <AirBridge/ABProduct.h>
#import <AirBridge/ABEcommerceEvent.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABProduct* product2 = [[ABProduct alloc] init];
product2.idx = @"idx2";
product2.name = @"name2";
product2.price = @200;
product2.currency = @"USD";
product2.orderPosition = @2;
product2.quantity = @2;

ABEcommerceEvent* event = [[ABEcommerceEvent alloc] initWithProducts:@[product1, product2]];
event.cartID = @"cartID";
event.currency = @"KRW";
event.eventValue = @300;

[event sendAddProductToCart];
let product1 = ABProduct()
product1.idx = "idx1"
product1.name = "name1"
product1.price = 100
product1.currency = "USD"
product1.orderPosition = 1
product1.quantity = 1;

let product2 = ABProduct()
product2.idx = "idx2"
product2.name = "name2"
product2.price = 200
product2.currency = "USD"
product2.orderPosition = 2
product2.quantity = 2;

let event = ABEcommerceEvent(products: [product1, product2])
event?.cartID = "cartID"
event?.currency = "KRW"
event?.eventValue = 300

event?.sendAddProductToCart()

Purchase

#import <AirBridge/ABProduct.h>
#import <AirBridge/ABEcommerceEvent.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABProduct* product2 = [[ABProduct alloc] init];
product2.idx = @"idx2";
product2.name = @"name2";
product2.price = @200;
product2.currency = @"USD";
product2.orderPosition = @2;
product2.quantity = @2;

ABEcommerceEvent* event = [[ABEcommerceEvent alloc] initWithProducts:@[product1, product2]];
event.isInAppPurchase = YES;
event.eventValue = @300;
event.transactionID = @"transactionID";
event.currency = @"KRW";

[event sendCompleteOrder];
let product1 = ABProduct()
product1.idx = "idx1"
product1.name = "name1"
product1.price = 100
product1.currency = "USD"
product1.orderPosition = 1
product1.quantity = 1

let product2 = ABProduct()
product2.idx = "idx2"
product2.name = "name2"
product2.price = 200
product2.currency = "USD"
product2.orderPosition = 2
product2.quantity = 2

let event = ABEcommerceEvent(products: [product1, product2])
event?.isInAppPurchase = true;
event?.eventValue = @300;
event?.transactionID = @"transactionID";
event?.currency = @"KRW";

event?.sendCompleteOrder()

Testing

Check event is existed on airbridge dashboard when send event with SDK.

  1. Send event with SDK.
  2. Check event is existed on Airbridge dashboard > Raw Data > App Real-time Logs.

Advanced Setup


Session Timeout

Call setSessionTimeout method at the top of code that initialize SDK to change setting.

Session timeout is in milliseconds and must be in 0 ~ 604800000 (7 days).

Default value of session timeout is 1000 * 60 * 5 (5 minutes).

[AirBridge setSessionTimeout:1000 * 60 * 5];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
AirBridge.setSessionTimeout(1000 * 60 * 5)

AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)

Hash User Indentifier

Email and phone are automatically hashed by SHA256.
Call setIsUserInfoHashed method at the top of code that initialize SDK to change setting.

// Disable hash user
[AirBridge setIsUserInfoHashed:NO];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
// User 정보 Hash 화 해제
AirBridge.setIsUserInfoHashed(false) 

AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)

Track Facebook Deferred Applinks

With following settings, SDK can track facebook deferred app link.

  1. Install facebook SDK with https://developers.facebook.com/docs/ios/getting-started link.
  2. Open ios/[Project name]/AppDelegate file.
  3. Call setIsFacebookDeferredAppLinkEnabled at the top of code that initialize SDK.
[AirBridge setIsFacebookDeferredAppLinkEnabled:YES];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
AirBridge.setIsFacebookDeferredAppLinkEnabled(true)

AirBridge.getInstance("YOUR_APP_TOKEN", appName: "YOUR_APP_NAME", withLaunchOptions: launchOptions)

Track Airbridge Link Only

SDK always send deeplink event when application is opened with deeplink.

Call setIsTrackAirbridgeDeeplinkOnly at the top of code that initialize SDK with YES.
Then, SDK send deeplink event only when application is opened with deeplink from airbridge.

// Send deeplink event only when application is opened with `deeplink from airbridge`
[AirBridge setIsTrackAirbridgeDeeplinkOnly:YES];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
// Airbridge 를 통한 딥링크 로 앱이 열린 경우에만 딥링크 이벤트를 전송
AirBridge.setIsTrackAirbridgeDeeplinkOnly(true)

AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)

Track Deep Link with Push Notification

Call handleURLSchemeDeeplink method to send deeplink of payload to SDK when user click push notification.

- (void)         application:(UIApplication *)application 
didReceiveRemoteNotification:(NSDictionary *)userInfo 
      fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler 
{
    if (UIApplication.sharedApplication.applicationState == UIApplicationStateInactive) {
        NSURL* url = // deeplink of push notification's payload
        
        [AirBridge.deeplink handleURLSchemeDeeplink:url];
    }
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center 
didReceiveNotificationResponse:(UNNotificationResponse *)response 
         withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0)) 
{
    if (UIApplication.sharedApplication.applicationState == UIApplicationStateInactive
        && [response.actionIdentifier isEqual:UNNotificationDefaultActionIdentifier])
    {
        NSURL* url = // deeplink of push notification's payload
        
        [AirBridge.deeplink handleURLSchemeDeeplink:url];
    }
}
func application(_ application: UIApplication, 
                 didReceiveRemoteNotification userInfo: [AnyHashable : Any], 
                 fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) 
{
    if UIApplication.shared.applicationState == .inactive {
        let url = // 푸시 알림 페이로드의 딥링크
            
        AirBridge.deeplink()?.handleURLSchemeDeeplink(url)
    }
}

@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, 
                            didReceive response: UNNotificationResponse, withCompletionHandler 
                            completionHandler: @escaping () -> Void) 
{
    if UIApplication.shared.applicationState == .inactive,
       response.actionIdentifier == UNNotificationDefaultActionIdentifier
    {
        let url = // 푸시 알림 페이로드의 딥링크
            
        AirBridge.deeplink()?.handleURLSchemeDeeplink(url)
    }
}

Track Uninstall Event

Check out Uninstall tracking page.

Opt-Out

When autoStartTrackingEnabled is set to false before SDK is initialized, then SDK do not send event to server until startTracking method is called.

AirBridge.autoStartTrackingEnabled = NO;

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

[AirBridge startTracking];
AirBridge.setAutoStartTrackingEnabled(false)

AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)

AirBridge.startTracking()

Add Device Alias

Another ID of device can be inserted to SDK.

[AirBridge.state setDeviceAlias:@{@"key": @"value"}];
[AirBridge.state addDeviceAliasWithKey:@"key" value:@"value"];
AirBridge.state()?.setDeviceAlias(["key": "value"])
AirBridge.state()?.addDeviceAlias(withKey: "key", value: "value")

Maximum of device alias is 10.
Maximum of device alias' key is 128
Maximum of device alias' value is 128.
Device alias' value must satisfy [a-z_][a-z0-9_]* expression.

Tracking Authorize Timeout

When use the AppTrackingTransparency.framework to show Allow tracking alert, IDFA is not collected because install event is sent before selection.

When use trackingAuthorizeTimeout setting, SDK delay the install event until selection or timeout.

trackingAuthorizeTimeout is millisecond.
Install event can be delayed because of trackingAuthorizeTimeout
trackingAuthorizeTimeout is restarted every App restart

When ATT status is selected or timeout alerted, deferred deeplink is delivered to callback

To do not restart timeout every App restart, set isRestartTrackingAuthorizeTimeout as false

AirBridge.setting.trackingAuthorizeTimeout = 120 * 1000;
AirBridge.setting.isRestartTrackingAuthorizeTimeout = NO;

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
AirBridge.setting()?.trackingAuthorizeTimeout = 120 * 1000
AirBridge.setting()?.isRestartTrackingAuthorizeTimeout = false

AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)

Hybrid Application


Send event on WebView

iOS SDK can send events from Web SDK on WebView.

Add airbridge web interface to controller of WebView.

WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];

WKUserContentController* controller = [[WKUserContentController alloc] init];
[AirBridge.webInterface injectTo:controller withWebToken:@"YOUR_WEB_TOKEN"];

configuration.userContentController = controller;
    
WKWebView* webview = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];
let configuration = WKWebViewConfiguration()
        
let controller = WKUserContentController()
AirBridge.webInterface()?.inject(to: controller, withWebToken: "YOUR_WEB_TOKEN")
        
configuration.userContentController = controller
        
webView = WKWebView(frame: .zero, configuration: configuration)

YOUR_WEB_TOKEN can be found on the dashboard at Settings > Tokens > App SDK Token.

Troubleshooting


Webcredentials

When there are no webcredentials:... setting, application's autofill passwords are saved to applinks:YOUR_APP_NAME.airbridge.io or applinks:YOUR_APP_NAME.deeplink.page domain.

When need to change domain, following settings is needed.

  1. Below JSON should be hosted on https://example.com/.well-known/apple-app-site-association link.
{
    "webcredentials": {
        "apps": ["TEAM_ID.APP_BUNDLE_ID"]
    }
}

Example) 9JA89QQLNQ.com.apple.wwdc

  1. Move to Xcode > Project file > Signing & Capabilities > Associated Domains.
  2. Click + and add webcredentials:example.com.

Updated 3 months ago

iOS SDK


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.