Location Tracking - adform/adform-ios-sdk GitHub Wiki

Enabling location tracking on Adform Advertising SDK

Adform Advertising SDK has the ability to track user location and serve advertisement based on its current position. This feature is enabled globally through AdformSDK class singleton object. By default user location tracking is disabled. This setting doesn't persist between application launches, therefore you need to enable location tracking on every app launch. The best place to do this is application:didFinishLaunchingWithOptions: application delegate method.

Swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    AdformSDK.setAllowUseOfLocation(true)
    
    return true
}
Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [AdformSDK allowUseOfLocation:YES];
    
    return YES;
}

It is important that you define NSLocationWhenInUseUsageDescription key in your application's info.plist file, if you don't have one. Otherwise, location tracking won't work. You should set its value to "Your location will be used to show relevant ads nearby." or its translation.

⚠️ **GitHub.com Fallback** ⚠️