https://github.com/intuit/LocationManager
#import "ViewController.h"
#import "INTULocationManager.h"
/**
* ios 8以上 需要在plist中配置
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
*/
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// 1. 创建管理者对象
INTULocationManager *mgr = [INTULocationManager sharedInstance];
// 2. 获取位置
[mgr requestLocationWithDesiredAccuracy:INTULocationAccuracyCity timeout:10.0 block:^(CLLocation *currentLocation, INTULocationAccuracy achievedAccuracy, INTULocationStatus status){
if (status == INTULocationStatusSuccess) {
LogRed(@"获取位置成功%f -- %f",currentLocation.coordinate.longitude, currentLocation.coordinate.latitude);
}else{
LogGreen(@"获取失败");
}
}];
}