iOS 8 Mapview Current Location not fire

后端 未结 3 1985
你的背包
你的背包 2021-01-05 18:45

MKMapview current user location not fire in iOS-8,previous iOS-7 & iOS-6 are working fine.

     self.         


        
3条回答
  •  -上瘾入骨i
    2021-01-05 19:10

    In ios 8 Authorization is required as below

        NSString * osVersion = [[UIDevice currentDevice] systemVersion];
        if ([osVersion floatValue]>= 8.0 ) {
        [_CLLocationManager requestAlwaysAuthorization]; //Requests permission to use location services whenever the app is running. 
    // [_CLLocationManager requestWhenInUseAuthorization]; //Requests permission to use location services while the app is in the foreground. 
        }
        [_CLLocationManager startUpdatingLocation];
    

    And you need to add two keys in the plist

    1.NSLocationAlwaysUsageDescription

    2.NSLocationWhenInUseUsageDescription

    enter image description here

提交回复
热议问题