#import <CoreLocation/CoreLocation.h>
@property(nonatomic,strong) CLLocationManager *locationManager;//arc下定位记得使用强引用。弱引用会导致开启定位提示过早被释放。
//定位方法
- (void)getLocation{
if (!_locationManager) {
_locationManager = [[CLLocationManager alloc] init];
}
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
//提示用户开启定位
[_locationManager requestAlwaysAuthorization];
}
_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
_locationManager.distanceFilter = 5.0;
//开启定位
}
//实现协议
#pragma mark - CLLocationManagerDelegate
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
CLLo