Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Custom message for Location permission alert in iOS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 1.78k
    Comment on it

    If you are using Location Manager to get user's current location then you have ask Location Permission first. iOS provides you access to user's location if user accepts it. Here is the code :-

    Below code will return you location manager object.

    -(CLLocationManager*) getLocation{
        CLLocationManager *locationManager = [[CLLocationManager alloc] init];
        locationManager.delegate = self;
        locationManager.desiredAccuracy = kCLLocationAccuracyBest;
        locationManager.distanceFilter = kCLDistanceFilterNone;
        [locationManager startUpdatingLocation];
        if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
            [locationManager requestWhenInUseAuthorization];
        }
        return locationManager;
    }

    After implementing above code just open your .plist file and add two properties to display permission alert with custom message.

    1. NSLocationWhenInUseUsageDescription
    2. Privacy - Location Usage Description

    See attached screenshot for help. Happy Coding!!!

    Custom message for Location permission alert in iOS

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: