获取经纬度 CLLocation
// 导入库 #import <CoreLocation/CoreLocation.h> // 注意 : // 需要在 info.plist 中导入前两个字段 //NSLocationAlwaysUsageDescription //NSLocationWhenInUseUsageDescription @interface ViewController ()< CLLocationManagerDelegate > @property ( nonatomic , strong ) CLLocationManager *locationManager; @end @implementation ViewController - ( void )viewDidLoad { [ super viewDidLoad ]; // 初始化 locationManger 管理器对象 CLLocationManager *locationManager=[[ CLLocationManager alloc ] init ]; self . locationManager =locationManager; // 判断当前设备定位服务是否打开 if (![ CLLocationManager locationServicesEnabled ]) { NSLog ( @" 设备尚未打开定位服务 "