iOS 8 CLLocationManager asking for user permission

Pre iOS 8 it was enough to allocate location manager object to generate a permission request


locationManager=[[CLLocationManager alloc] init];

but post iOS8 things have changed, in order to initiate the the request for location information you have to do following steps


Add keys in info plist

NSLocationWhenInUseUsageDescription   : against this key description of the usage information will go as string parameter in infoplist.The same string will be part of alert message asking for permission when     [locationManager requestWhenInUseAuthorization] method is invoked.


NSLocationAlwaysUsageDescription   : against this key description of the always usage information will go.It will describe why location info is needed even when you are not using app.The description string will be part of alert message asking for location permission when you invoke  [locationManager requestAlwaysAuthorization] method.


requestAlwaysAuthorization grants you requestWhenInUseAuthorization as well but not vice versa