I am developing an application with location and getting coordinates successfully then i am calling the webservice to store the coordinates, but when i use ios 7.1 device then didupdatelocation method is not called repeadly. Here is my code
if ([CLLocationManager locationServicesEnabled])
{
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.pausesLocationUpdatesAutomatically=NO;
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy=kCLLocationAccuracyBest;
[self.locationManager startUpdatingLocation];
}
and this
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
if (UIApplication.sharedApplication.applicationState == UIApplicationStateActive)
{
CLLocationCoordinate2D center;
center.latitude = [[locations objectAtIndex:([locations count]-1)] coordinate].latitude;
center.longitude = [[locations objectAtIndex:([locations count]-1)] coordinate].longitude;
_point = [[MKPointAnnotation alloc] init];
_point.coordinate = center;
if(appDelegate.strVehicleType!=nil)
{
[self checkInternet];
}
NSLog(@"Changed");
[_locationManager stopUpdatingLocation];
}
else
{
CLLocationCoordinate2D center;
center.latitude = [[locations objectAtIndex:([locations count]-1)] coordinate].latitude;
center.longitude = [[locations objectAtIndex:([locations count]-1)] coordinate].longitude;
_point = [[MKPointAnnotation alloc] init];
_point.coordinate = center;
if(appDelegate.strVehicleType!=nil)
{
[self checkInternet];
}
NSLog(@"Location Changed in Background")
;
[_locationManager stopUpdatingLocation];
}
}
I have tried above code the location updates repetedly in ios 6 and ios 7 but not updating in 7.1, So please anyone have idea where is the issue? or is their any different method to use.
Thanx in advance.