Skip to content

Configuration

This page covers installation and the minimal initialization required to start the Affise SDK. For the full builder surface (custom domain, disabled modules, init callbacks), see Optional setup.

Add the pods you need to your Podfile. Verbatim from the README:

affise_version = '1.7.8'
# Affise SDK library
pod 'AffiseAttributionLib', affise_version
# Affise modules
pod 'AffiseModule/AdService', affise_version
pod 'AffiseModule/Advertising', affise_version
pod 'AffiseModule/Google', affise_version
pod 'AffiseModule/Link', affise_version
pod 'AffiseModule/Persistent', affise_version
pod 'AffiseModule/Status', affise_version
pod 'AffiseModule/Subscription', affise_version
pod 'AffiseModule/TikTok', affise_version

Or pull directly from GitHub:

affise_version = '1.7.8'
# Affise SDK library
pod 'AffiseAttributionLib', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
# Affise modules
pod 'AffiseModule/AdService', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
pod 'AffiseModule/Google', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
pod 'AffiseModule/Link', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
pod 'AffiseModule/Persistent', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
pod 'AffiseModule/Status', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
pod 'AffiseModule/Subscription', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
pod 'AffiseModule/TikTok', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version
# Add the following line if you need AppsFlyer event forwarding (not in README Podfile example):
# pod 'AffiseModule/AppsFlyer', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version

Verbatim from the README:

  1. Open your Xcode project, navigate to File → Add Packages.
  2. In the Add New Package window enter https://github.com/affise/affise-mmp-sdk-ios in the search field.
  3. Click the Add Package button.
  4. In the Choose Package Products window select required packages and click Add Package. They will be added to your iOS project and linked automatically.
  • The Advertising module requires NSUserTrackingUsageDescription in Info.plist; the app will crash if it is missing.

  • For SKAdNetwork postbacks you can declare an attribution report endpoint in Info.plist:

    <key>CFBundleURLTypes</key>
    <array>
    <dict>
    <key>NSAdvertisingAttributionReportEndpoint</key>
    <string>https://affise-skadnetwork.com/</string>
    </dict>
    </array>

Call Affise.settings(...) on application launch and chain .start(app:launchOptions:). The entry point is @objc public final class Affise: NSObject (AffiseAttributionLib/Classes/Affise.swift:10). The factory is Affise.settings(affiseAppId:secretKey:) (AffiseAttributionLib/Classes/Affise.swift:23-29); it returns an AffiseSettings whose terminal method is start(app:launchOptions:) (AffiseAttributionLib/Classes/settings/AffiseSettings.swift:141-151).

import AffiseAttributionLib
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
Affise
.settings(
affiseAppId: "Your appId", //Change to your app id
secretKey: "Your secretKey" //Change to your appToken
)
.start(app: application, launchOptions: launchOptions) // Start Affise SDK
return true
}
}

See Optional setup for custom domain, init callbacks, module disabling, and production/debug toggles.