I tried to solve this problem for several days, but could not find any solutions that work. I checked all the posts in stackoverflow and tried all of their solutions, and nothing seems to work. I also tried the Apple test project for CLLocation, which works great for me. I used bits and pieces from the Apple Test Project
https://developer.apple.com/library/ios/samplecode/LocateMe/Listings/README_md.html
But my code doesn't work at all. Unable to get the name DidupdateToLocation.
Here is my code (in viewDidLoad)
_locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; // This is the most important property to set for the manager. It ultimately determines how the manager will // attempt to acquire location and thus, the amount of power that will be consumed. self.locationManager.desiredAccuracy = kCLLocationAccuracyBest; // Once configured, the location manager must be "started" // // for iOS 8, specific user level permission is required, // "when-in-use" authorization grants access to the user location // // important: be sure to include NSLocationWhenInUseUsageDescription along with its // explanation string in your Info.plist or startUpdatingLocation will not work. // if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { [self.locationManager requestWhenInUseAuthorization]; } [self.locationManager startUpdatingLocation]; [self performSelector:@selector(stopUpdatingLocationWithMessage:) withObject:@"Timed Out" afterDelay:30];
I checked to make sure locationServicesEnabled is enabled.
I added the NSLoationWhenInUseUsageDescription property to the info.plist file. Is there any other property that I need to add or enable any services?
For the sake of love for God, I cannot find out what I did wrong. Can someone please help me with this.
source share