MKMapview
current user location not fire in iOS-8
,previous iOS-7
& iOS-6
are working fine.
self.
In iOS8, you need to request user's authorization before getting their location.
There are two kinds of request:
-[CLLocationManager requestWhenInUseAuthorization]
lets you get users' location only when the app is awaken.
-[CLLocationManager requestAlwaysAuthorization]
lets you get users' location even when it's in the background.
You can choose between them accordingly.
For example, put this before you start updating location:
// ask for authorization
CLLocationManager * locationManager = [[CLLocationManager alloc] init];
// check before requesting, otherwise it might crash in older version
if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[locationManager requestWhenInUseAuthorization];
}
Furthermore, don't forget to add two keys
NSLocationWhenInUseUsageDescription
and
NSLocationAlwaysUsageDescription
into your info.plist.
Leave the values empty to use the default messages or you can customize your own by inputting the values.