ios8以前系统地图定位不好用了,
ios8要使用地图定位,需要设置
第一步,在info.plist表中添加两个字段
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
第二步:直接用第三方框架INTULocationManager
INTULocationManager *mgr = [INTULocationManagersharedInstance];
if (mgr.locationServicesAvailable
== NO) {
return;
}
//
请求位置
[mgr
requestLocationWithDesiredAccuracy:INTULocationAccuracyCitytimeout:10.0block:^(CLLocation
*currentLocation, INTULocationAccuracy achievedAccuracy,
INTULocationStatus status) {
if (status ==
INTULocationStatusSuccess) {
// 请求成功
NSLog(@"ddddddd%f %f",
currentLocation.coordinate.latitude, currentLocation.coordinate.longitude);
}
}];
这样就能使用地图,不论手机的系统是ios几都可以用了
时间: 2024-10-06 20:36:27