2. Install the Airflux SDK
1. SDK Installation
The Airflux SDK can be installed using various dependency management tools. Choose one of the following methods to add the SDK to your project.
In the Xcode menu bar, click [File] > [Add Packages...]
In the top-right search bar, enter the following URL and then click [Add Package].
Confirm the detected package and continue to click [Add Package] to complete the installation.
You can confirm that the Airbridge SDK has been added under Package Dependencies in the Project Navigator.
1.1 User Script Sandboxing
In Xcode's Build Settings, set User Script Sandboxing to No. For more details, refer to the CocoaPods documentation.
1.2 Install CocoaPods and Set Up the Podfile
In your macOS Terminal, install CocoaPods using the following command:
brew install cocoapodsNavigate to your Xcode project folder. The easiest way is to type
cdand then drag your project folder directly into the Terminal window:cd /path/to/your/XcodeProjectRun this command to create a
Podfile:pod initOpen the
Podfileand add the following code to thetargetblock.Replace
$HERE_LATEST_VERSIONwith the latest SDK version, available on the Airflux SDK Versions page.
target '[Project Name]' do
...
# Replace $HERE_LATEST_VERSION with latest version
# - Example: pod 'airflux-ios-sdk', '4.X.X'
pod 'airflux-ios-sdk', '$HERE_LATEST_VERSION'
...
end1.3 Open Your Xcode Project
After installation, you must open the YOUR_PROJECT.xcworkspace file from now on. This file contains both your app project and the installed Pods. Do not open the old .xcodeproj file
Run the
tuist editcommand in your Terminal.Add the SDK as a remote package in the
project.packagesblock. Then, add the SDK as apackagedependency toproject.targets[...].target.dependencies.Replace
$HERE_LATEST_VERSIONwith the latest SDK version, available on the Airflux SDK Versions page.
import ProjectDescription let project = Project( packages: [ .remote( url: "https://github.com/ab180/airflux-ios-sdk-deployment", // Replace $HERE_LATEST_VERSION with latest version // - Example: requirement: .exact(from: "4.X.X") requirement: .exact(from: "$HERE_LATEST_VERSION") ), ... ], targets: [ .target( dependencies: [ .package(product: "Airflux", type: .runtime), ... ] ), ... ], ... )Run the
tuist generatecommand.You can confirm that Airflux has been added to the Package Dependencies in Xcode.
If you prefer a manual approach, you can directly download and add the SDK to your Xcode project.
Download the Airflux iOS SDK from the following URL:
Unzip the file and find
Airflux.xcframework.In Xcode, go to your project file and navigate to the [General] tab.
Scroll down to the [Frameworks, Libraries, and Embedded Content] section and click the
+button.Click [Add Other...], then select [Add Files...] and choose the
Airflux.xcframeworkfolder you downloaded.Ensure that
Airflux.xcframework's Embed setting is configured to -Embed & Sign.
2. SDK Initialization
Initialize the SDK by referring to the code below.
App Name
AirfluxOptionBuilder()
string
Input the App Name from the Airbridge dashboard.
Required
App Token
AirfluxOptionBuilder()
string
Input the App Token from the Airbridge dashboard.
Required
SDK Enabled
setSDKEnabled()
boolean
Set whether to enable the SDK upon initialization.
true: The SDK is initialized in active mode.false: The SDK is initialized in inactive mode and is enabled upon calling the Airflux.EnableSDK()function.
Optional
Auto Start Tracking Enabled
setAutoStartTrackingEnabled()
boolean
Set whether to collect events automatically upon SDK initialization.
true: Event collection starts automatically upon initialization.false: Event collection starts upon calling theAirflux.StartTracking()function.
Optional
Log Level
setLogLevel()
AirfluxLogLevel
Set the log level for the Airflux SDK. Choose from debug, info, warning, error, fault .
Optional
Session Timeout
setSessionTimeout()
double
The default value is 300 seconds. Modify if needed.
Optional
Allow Every Country Enabled
setAllowEveryCountryEnabled()
boolean
When set to true, all countries are allowed to follow Airflux's optimization policies. To use a specific list of countries, set it to false and provide a list using setCountryAllowlist().
Optional
Country Allowlist
setCountryAllowlist()
List<String>
Set the countries where calling the Airflux's inference API should be allowed. Use country codes following the ISO 3166-1 alpha-2 format (e.g., US, KR). You can set multiple countries using the Country Allowlist array. Airflux identifies a country based on the value tied to the device.
Optional
import UIKit
import Airflux
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Creates the option for initializing the Airflux SDK.
// Replace "YOUR_APP_NAME" and "YOUR_APP_TOKEN" with your actual credentials.
let option = AirfluxOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_TOKEN")
// Automatically enables the SDK on startup.
.setSDKEnabled(true)
// Automatically starts tracking events.
.setAutoStartTrackingEnabled(true)
// Sets the log level to debug for detailed logs.
.setLogLevel(AirfluxLogLevel.debug)
// Sets the session timeout to 300 seconds (5 minutes).
.setSessionTimeout(second: 300)
// Allows Airflux features in all countries.
.setAllowEveryCountryEnabled(true)
// Uncomment the line below to allow only specific countries.
// .setCountryAllowlist(["US", "KR", "JP"])
.build()
// Initializes the SDK with the configured option.
Airflux.initializeSDK(option: option)
return true
}
}#import "AppDelegate.h"
#import <airflux/Airflux.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Creates the option for initializing the Airflux SDK.
// Replace "YOUR_APP_NAME" and "YOUR_APP_TOKEN" with your actual credentials.
AirfluxOptionBuilder *optionBuilder = [AirfluxOptionBuilder alloc] initWithName:@"YOUR_APP_NAME" token:@"YOUR_APP_TOKEN"];
// Automatically enables the SDK on startup.
[optionBuilder setSDKEnabled:YES];
// Automatically starts tracking events.
[optionBuilder setAutoStartTrackingEnabled:YES];
// Sets the log level to debug for detailed logs.
[optionBuilder setLogLevel:AirfluxLogLevelDebug];
// Sets the session timeout to 300 seconds (5 minutes).
[optionBuilder setSessionTimeoutWithSecond:300];
// Allows Airflux features in all countries.
[optionBuilder setAllowEveryCountryEnabled:YES];
// Uncomment the line below to allow only specific countries.
// [optionBuilder setCountryAllowlist:@[@"US", @"KR", @"JP"]];
AirfluxOption *option = [optionBuilder build];
// Initializes the SDK with the configured option.
[Airflux initializeSDKWithOption:option];
return YES;
}import SwiftUI
import Airflux
@main
struct YourApp: App {
init() {
// Creates the option for initializing the Airflux SDK.
// Replace "YOUR_APP_NAME" and "YOUR_APP_TOKEN" with your actual credentials.
let option = AirfluxOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_TOKEN")
// Automatically enables the SDK on startup.
.setSDKEnabled(true)
// Automatically starts tracking events.
.setAutoStartTrackingEnabled(true)
// Sets the log level to debug for detailed logs.
.setLogLevel(AirfluxLogLevel.debug)
// Sets the session timeout to 300 seconds (5 minutes).
.setSessionTimeout(second: 300)
// Allows Airflux features in all countries.
.setAllowEveryCountryEnabled(true)
// Uncomment the line below to allow only specific countries.
// .setCountryAllowlist(["US", "KR", "JP"])
.build()
// Initializes the SDK with the configured option.
Airflux.initializeSDK(option: option)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}3. Verification
iOS Console Log Check
To view detailed log information for your app in Xcode, use the following method before initializing the SDK
You can set the log output level using the setLogLevel function. Setting it to AirfluxLogLevel.DEBUG allows you to see all Airflux logs.
4. Frequently Asked Questions
Last updated

