SDK Migration - iOS SDK (v4)

This article contains the information required to update the Airbridge iOS SDK. We recommend checking the information regarding all versions.

Update from v1.x to v4.0

Check the information below when updating the iOS SDK to v4.0. The iOS SDK name has changed from "AirBridge" to "Airbridge," and the "AirBridge class" has changed to "Airbridge class." Functions and options have been renamed.

SDK installation and initialization

The CocoaPods package name, SwiftPackageManager Git address, and direct install download URL have changed. Delete the existing iOS SDK and reinstall it by following the Airbridge guide.

The AirBridge.getInstance function used to initialize the SDK has been changed to the Airbridge.initializeSDK function. Also, the option setting functions have been changed to the AirbridgeOption and AirbridgeOptionBuilder classes.

SDK's options are no longer changed at runtime. Refer to the mapping below to write your new SDK initialization code.

1234567
import Airbridge
...
let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
    .setLogLevel(.warning)
    .setSessionTimeout(second: 300)
    .build()
Airbridge.initializeSDK(option: option)

The AirBridge.setDeeplinkCallback function has been replaced by the Airbridge.handleDeeplink function and handleDeferredDeeplink function.

AirBridge.deeplink().handle (or handleUniversalLink) and AirBridge.deeplink().handleURLSchemeDeeplink have been replaced by Airbridge.trackDeeplink.

The method for registering custom domains has changed. Previously, custom domains were added as values to the co.ab180.airbridge.trackingLink.customDomains key in Info.plist.

The changed method is to add them by calling the setTrackingLinkCustomDomains function during the SDK initialization phase.

In-app events and user data

Attention

Enter the value to the AirbridgeAttribute.VALUE instead of to the totalValue.

The logic where totalValue overwrites the value when using totalValue of setSemantics and defining the value with setValue has been removed from SDK v4.

The ABInAppEvent class has been replaced by the Airbridge.trackEvent function.

Follow the instructions below to change the ABInAppEvent class and setAction, setLabel, setValue, setSemantics, and setCustoms to the Airbridge.trackEvent function.

  • setCategory: If you are using ABCategory, you should use AirbridgeCategory. If you are using a String, enter it in the category parameter as is.

  • setAction: Enter the AirbridgeAttribute.ACTION key in the semanticAttributes parameter.

  • setLabel: Enter in the AirbridgeAttribute.LABEL key of the semanticAttributes parameter.

  • setValue: Enter in the AirbridgeAttribute.VALUE key of the semanticAttributes parameter.

  • setSemantics: If you are using ABSemanticsKey as the key in the semanticAttributes parameter, useAirbridgeAttribute. If you are using String, enter it as is. The value is entered regardless of the key.

  • setCustoms: In the customAttributes parameter, enter the key and value as they are.

See AirbridgeCategory, AirbridgeAttribute mapping, and the Airbridge.trackEvent function below.

The AirBridge.setDeviceAlias related functions have been replaced with AirBridge.setDeviceAlias related functions.

12345
import Airbridge
...
Airbridge.setDeviceAlias(key: "string", value: "string")
Airbridge.removeDeviceAlias(key: "string")
Airbridge.clearDeviceAlias()

The AirBridge.state().setUser related functions have been replaced with Airbridge.setUser related functions. The setUser function that sets user information at once is not supported.

1234567891011121314151617181920
import Airbridge
...
// identifier
Airbridge.setUserID("string")
Airbridge.clearUserID()
// addtional identifier
Airbridge.setUserAlias(key: "string", value: "string")
Airbridge.removeUserAlias(key: "string")
Airbridge.clearUserAlias()
...
// email, phone
Airbridge.setUserEmail("string")
Airbridge.clearUserEmail()
Airbridge.setUserPhone("string")
Airbridge.clearUserPhone()
// addtional attribute
Airbridge.setUserAttribute(key: "string", value: "string")
Airbridge.setUserAttribute(key: "number", value: 1000)
Airbridge.removeUserAttribute(key: "string")
Airbridge.clearUserAttributes()

Additional settings

The AirBridge.placement().click function and the AirBridge.placement().impression function have been replaced with the Airbridge.clickfunction and the Airbridge.impression function.

1234567891011121314151617181920
import Airbridge
...
let isHandled = Airbridge.click(trackingLink: url) {
    // when url is tracking link and succeed
} onFailure: { error in
    // when url is tracking link and failed
    // example: url is another app's tracking link, internet is not connected
}
if !isHandled {
    // when url is not tracking link
}
...
let isHandled = Airbridge.impression(trackingLink: url) {
    // when url is tracking link and succeed
} onFailure: { error in
    // when url is tracking link and failed
}
if !isHandled {
    // when url is not tracking link
}

The AirBridge.webInterface().inject function has been replaced by Airbridge.setWebInterface function.

123456
import Airbridge
...
Airbridge.setWebInterface(
    controller: controller,
    webToken: "YOUR_WEB_TOKEN"
)

Update within v1.x

See the major changes in each version of the iOS SDK.

For Airbridge Apps created after September 4, 2023, an issue where the deep link URL provided in the deep link callback was decoded twice from the content entered in the Airbridge dashboard has been resolved. This issue was found in versions v1.34.0 to v1.35.1.

For Airbridge Apps created after September 4, 2023, the "airbridge_referrer" will no longer be added to the deep link URL provided in the deep link callback and will instead pass it to the information entered in the Airbridge Dashboard.

Contact your Airbridge CSM if your Airbridge App was created before September 4, 2023, and want to apply this change. If you don't have a designated CSM, contact the Airbridge Help Center.

v1.33.0 - SKAdNetwork

When a user updates an app with iOS SDK v1.33.0 or earlier to v1.33.0 or later, the last calculated conversion value will be finalized.

v1.32.1 - User privacy

The default setting for trackingAuthorizeTimeout was changed from 0 seconds to 30 seconds.

Was this page helpful?

Have any questions or suggestions?