Location in SDK 6

If your application uses Location Services and a user has granted permission to use their current location, the SDK will automatically send location data with ad requests. Location data enables more relevant advertisements to reach your users. The SDK will not present a location permission dialog on its own.

Enabling Location in Your App

1. Add a description for NSLocationWhenInUseUsageDescription key to your App’s Info.plist file.

This is covered in step 3 of the integration guide.

2. Create a location object
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) CLLocationManager *locationManager;

3. Request access to the user’s location

The example below shows how to get the user’s location when the app launches. For many application, there may be a more appropriate time to ask the user for location permissions.

#import "AppDelegate.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.locationManager = [[CLLocationManager alloc] init];
    if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
        [self.locationManager requestWhenInUseAuthorization];
    else {
        [self.locationManager startUpdatingLocation];
    return YES;

Disabling SDK 6 Location

Note: CoreLocation is a required framework, even if sending location data is disabled.

SDK 6 is designed to make passing location data as simple as possible. However, there may be circumstances where a publisher may have access to location, but is not allowed to use that data for monetization purposes. For situations like this, it is possible to explicitly disable SDK 6 from accessing location data. To explicitly disable sending location data with ad requests set [[MMSDK sharedInstance] setSendLocationIfAvailable:NO];.