问题
I've been working with maps for a while so I understand the basics of what needs to happen to show the user's location
map.showsUserLocation = YES; //also have the box checked in .xib
set up the locationManager
- (CLLocationManager *)locationManager {
if (locationManager != nil) {
return locationManager;
}
locationManager = [[CLLocationManager alloc] init];
[locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
[locationManager setDelegate:self];
return locationManager;
}
I've logged and see that I'm hitting the didUpdateUserLocation method
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
if (!userLoc)
{
//NSLog(@"Mapping - didUpdateUserLocation");
userLoc = userLocation.location;
}
[locationManager startUpdatingLocation];
}
and I'm also making sure I don't remove the user's annotation
if (![annotation isKindOfClass:[MKUserLocation class]])
...so why is the blue dot showing and pulsing on the iPhone, but showing as a white dot only on the iPad? (Both devices are iOS 7.1.1)
回答1:
Only iPad's with cellular will have access to the GPS which is what the blue pulsing dot represents in MKMapView. Every iPhone has GPS which is why you are seeing the pulsing dot on that device.
Without cellular (3G/4G/LTE) the iPad can only use WiFi to triangulate position, which is not accurate enough for navigation.
来源:https://stackoverflow.com/questions/24394950/uimapview-user-location-annotation-is-white-not-pulsing-blue-in-ipad-only