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.
CocoaPods
Section titled “CocoaPods”Add the pods you need to your Podfile. Verbatim from the README:
affise_version = '1.7.8'# Affise SDK librarypod 'AffiseAttributionLib', affise_version# Affise modulespod 'AffiseModule/AdService', affise_versionpod 'AffiseModule/Advertising', affise_versionpod 'AffiseModule/Google', affise_versionpod 'AffiseModule/Link', affise_versionpod 'AffiseModule/Persistent', affise_versionpod 'AffiseModule/Status', affise_versionpod 'AffiseModule/Subscription', affise_versionpod 'AffiseModule/TikTok', affise_versionOr pull directly from GitHub:
affise_version = '1.7.8'# Affise SDK librarypod 'AffiseAttributionLib', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_version# Affise modulespod 'AffiseModule/AdService', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_versionpod 'AffiseModule/Advertising', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_versionpod 'AffiseModule/Google', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_versionpod 'AffiseModule/Link', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_versionpod 'AffiseModule/Persistent', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_versionpod 'AffiseModule/Status', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_versionpod 'AffiseModule/Subscription', :git => 'https://github.com/affise/affise-mmp-sdk-ios.git', :tag => affise_versionpod '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_versionSwift Package Manager
Section titled “Swift Package Manager”Verbatim from the README:
- Open your Xcode project, navigate to File → Add Packages.
- In the Add New Package window enter
https://github.com/affise/affise-mmp-sdk-iosin the search field. - Click the Add Package button.
- In the Choose Package Products window select required packages and click Add Package. They will be added to your iOS project and linked automatically.
Info.plist requirements
Section titled “Info.plist requirements”-
The Advertising module requires
NSUserTrackingUsageDescriptioninInfo.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>
Initialize
Section titled “Initialize”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
@mainclass 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 }}#import "AppDelegate.h"@import AffiseAttributionLib;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch.
AffiseSettings *affise = [Affise settingsWithAffiseAppId:@"Your appId" //Change to your app id secretKey:@"Your secretKey" //Change to your appToken ]; [affise setProduction:false]; //To enable debug methods set Production to false [affise startWithApp:application launchOptions:launchOptions]; // Start Affise SDK
return YES;}@endNext steps
Section titled “Next steps”See Optional setup for custom domain, init callbacks, module disabling, and production/debug toggles.