Since the release of the new beta version of iOS 8, I have not been able to successfully get the user's location. Prior to upgrading to iOS 8, I had no problems, but now it always returns 0.000000 as the current latitude and longitude. Is this just a bug in the new version? My code is below:
//from the .h file @interface MasterViewController : PFQueryTableViewController<CLLocationManagerDelegate,UITextFieldDelegate, UISearchBarDelegate, UISearchDisplayDelegate> { } @property (nonatomic, strong) CLLocationManager *locationManager; //from the .m file @synthesize locationManager = _locationManager; - (void)viewDidLoad { [super viewDidLoad]; [self.locationManager startUpdatingLocation]; } - (CLLocationManager *)locationManager { if (_locationManager != nil) { return _locationManager; } _locationManager = [[CLLocationManager alloc] init]; _locationManager.delegate = self; _locationManager.desiredAccuracy = kCLLocationAccuracyBest; return _locationManager; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { } - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { }
UPDATE This question has been answered ( Location services not working in iOS 8 ). For those who are still struggling with this in order to maintain backward compatibility with iOS 7, I used the following code:
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) { }
ios ios8 core-location mapkit
Jkoko
source share