I have a question about location.
I need to get location of latitude and longitude at iOS 5.1 and iOS 6 upper.
But I write NSLog in didUpdateLocations and didUpdateToLocation function .
I had not saw the log show in console.
I am use simulate set location . I am test latitude value is 25.317973, longtitude value is 121.538161 (D1).
Then I am test value is ( 25.917973, 121.538161 ) (D2).
D1 and D2 distance is more than 10 meter;
But I never saw the log show in console.
I attach my code below:
my .h file
#mport <GoogleMaps/GoogleMaps.h>
#import <CoreLocation/CoreLocation.h>
#import <Corelocation/CLLocationManagerDelegate.h>
@interface LocationMapViewController : AbstractViewController< CLLocationManagerDelegate, GMSMapViewDelegate >
@property (strong, nonatomic) CLLocationManager *locationManager;
@end
my .m file
- (void)viewDidLoad
{
[super viewDidLoad];
if( _locationManager == nil )
{
_locationManager = [CLLocationManager new];
_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
_locationManager.distanceFilter = 10.0f;
[_locationManager startUpdatingHeading];
}
-(void) locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"==latitude %f, longitude %f", [[locations objectAtIndex:([locations count]-1)] coordinate].latitude , [[locations objectAtIndex:([locations count]-1)] coordinate].longitude);
}
-(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSLog(@"====latitude %f, longitude %f", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
}
Have anyone know what's wrong with my code?
thank you very much