Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8128851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:03:57+00:00 2026-06-06T08:03:57+00:00

I am using core location framework inside my app.The didUpdateToLocation method is called two

  • 0

I am using core location framework inside my app.The didUpdateToLocation method is called two times when app starts very first time.I allocated location manager instance and initiate it and called startUpdatingLocation. And in didUpdateToLocation i am calling another function in which i am sending the current latitude and longitude to server so how can i avoid multiple calling of this function?

- (void)viewDidLoad
{
[super viewDidLoad];
self.locationManager = [[CLLocationManager alloc] init];
[self.mapView setShowsUserLocation:YES];
if( [CLLocationManager locationServicesEnabled])
{
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    locationManager.delegate = self;
    [locationManager startUpdatingLocation];
    locationManager.distanceFilter = 1000.0f;

else
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"GPS Disabled"          message:@"Enable GPS settings to allow the application to search for your current location" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alertView show];
    [alertView release];
}
}

  //Here is didUpdateToLocation method

 -(void)locationManager:(CLLocationManager *)manager
 didUpdateToLocation:(CLLocation *)newLocation
      fromLocation:(CLLocation *)oldLocation
   {
  self.lat = newLocation.coordinate.latitude;
  self.longi = newLocation.coordinate.longitude;

    NSLog(@"Updated Location : lat--%f long--%f",self.lat,self.longi);
   [self updateUserLocation];



  }

  //in this function i am sending the latitude and longitude to server.
 -(void)updateUserLocation
 {

   NSString *urlString = [[NSString stringWithFormat:@"http://appifylabs.com/tracemybuddies/index.php/iphone/updateUserLocation/?userId=1&latitude=%@&longitude=%@",self.lat,self.longi] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

[conn url_Connection:urlString withActivityView:self.activityView     withParentView:self.view];
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:03:58+00:00Added an answer on June 6, 2026 at 8:03 am

    Inside didUpdateToLocation, when oldLocation is received as NULL, return from the function.
    It will be NULL when first time your delegate will be called.

    Second, you can take the difference of time stamp between currentTime and newLocation.timeStamp. If it is not with in acceptable limit, return from the function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using core location framework inside my app and sending updated location to
I am using core location framework inside my app and i added location string
I am using core location framework inside my app i have to ask that
I am using core location framework inside my app i want to ask that
I am using core location framework inside my application and I set the location
My first location using Core Location is almost always invalid. My code is as
I'm developing a Core Data app that uses a model object called Location. The
I am using the ALAssets framework to access the Photo Library. The first time
In my application first i am finding the current location using corelocation framework, and
If I have a tab bar app, and plan on using Core Location in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.