Guest User

Untitled

a guest
Oct 21st, 2016
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
  2.     NSLog(@"locationManager didUpdateLocations: %@",locations);
  3.     if ([CLLocationManager locationServicesEnabled]){
  4.        
  5.         NSLog(@"Location Services Enabled");
  6.        
  7.         if ([CLLocationManager authorizationStatus]==kCLAuthorizationStatusDenied){
  8.             alert = [[UIAlertView alloc] initWithTitle:@"App Permission Denied"
  9.                                                message:@"To re-enable, please go to Settings and turn on Location Service for this app."
  10.                                               delegate:nil
  11.                                      cancelButtonTitle:@"OK"
  12.                                      otherButtonTitles:nil];
  13.             [alert show];
  14.         }
  15.     }
  16.     else {
  17.         for(int i=0;i<locations.count;i++){
  18.             CLLocation * newLocation = [locations objectAtIndex:i];
  19.             CLLocationCoordinate2D theLocation = newLocation.coordinate;
  20.             CLLocationAccuracy theAccuracy = newLocation.horizontalAccuracy;
  21.             self.myLocation = theLocation;
  22.             self.myLocationAccuracy = theAccuracy;
  23.         }
  24.         if (self.shareModel.afterResume==TRUE) {
  25.             appStatus=@"Killed";
  26.             self.locationTracker = [[LocationTracker alloc]init];
  27.            
  28.             self.locationTracker.str_latitude=[NSString stringWithFormat:@"%f",self.myLocation.latitude];
  29.             self.locationTracker.str_longitude=[NSString stringWithFormat:@"%f",self.myLocation.longitude];
  30.             self.locationTracker.pushStatus=FALSE;
  31.             [self.locationTracker GetDevice_LocationSettings];
  32.         }
  33.     }
  34. }
Add Comment
Please, Sign In to add comment