我正尝试将我的一个应用程序更新到IOS9和Xcode 7.2.1。位置管理器在早期版本中工作,但现在不起作用。没有错误或警告......没有。看来我的代码没有进入“didUpdateLocations”。我的代码在下面;位置管理器没有获取位置
- (void)setupViewController {
self.locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
{
[self.locationManager requestAlwaysAuthorization];
}
locationManager.desiredAccuracy = 100;
//locationManager.requestLocation;
[locationManager startUpdatingLocation];
//return coordinate;
[self performSelector:@selector(stopUpdatingLocation:) withObject:@"Timed Out" afterDelay:5];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
NSLog(@"Doesn't get here.");
self.bestEffortAtLocation = newLocation;
latitudeString = [[NSString alloc] initWithFormat:@"%g", newLocation.coordinate.latitude];
longitudeString = [[NSString alloc] initWithFormat:@"%g", newLocation.coordinate.longitude];
There is other code here that gets city, country, etc.
不知道在这一点上该怎么做。我寻找类似的问题,但没有发现任何东西。
非常感谢。完美工作。 – tombuarts