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

  • SEARCH
  • Home
  • 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 8858231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:46:52+00:00 2026-06-14T14:46:52+00:00

I am trying to get the current location for the phone, and then send

  • 0

I am trying to get the current location for the phone, and then send the coordinates to my webserver to process the data to return some results into my app.

The problem I am facing now is that the view loads first, then only it obtains the coordinates.

How do I get the coordinates first, so that I can send them to my webserver to process and send back the data so that I can be displayed on my view?

Thanks!

  • 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-14T14:46:53+00:00Added an answer on June 14, 2026 at 2:46 pm

    If your view controller really needs the location information before it is presented, it can have the presenting view controller perform the location services before the transition. If there is no presenting view controller (i.e. the view controller that needs the location is currently the root view controller), you can introduce a new root view controller which will perform the location services before transitioning to the main view controller.

    This presenting view controller should (per the Location Awareness Programming Guide) should create the CLLocationManager, initiate location services, and upon receiving the appropriate didUpdateLocations of the CLLocationManagerDelegate, it can then stop location services and transition to the main view controller. Perhaps this intermediate view controller should also show some nice “please wait” screen or a copy of the default.png image with a UIActivityIndicatorView while the location services are being performed.

    In practice, though, you don’t necessarily need to introduce this intermediate view controller. You could do it all with your primary view controller. You can employ asynchronous event-driven coding patterns. So, rather than requiring the location before the view is presented, you can defer the performance of the web services until after the location services have been satisfied. For example, this simple test project invokes location services, and upon completion, submits a web request to a weather service, and parses the JSON response. No intermediate view controller was needed.

    Note, though, that Apple frowns upon (i.e. may well reject) apps that only work if the location services succeed, so you may want to think about what your app is supposed to do if it simply is unable to use location services. You must gracefully handle that scenario, perhaps use the last known location.

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

Sidebar

Related Questions

I'm trying to get the current location of the phone through GPS. I followed
What I am trying is I get my current location (the coordinates) and i
I am trying to get the zip code of the users current location.I have
I'm trying to get my current location and show it on a map. Class
I am trying to get the name of the city of user's current location
I am trying to get current location of user using CLLocationCoordinate2D. I want the
I'm trying to get the current location using the iphone sdk. Here is the
Possible Duplicate: get current location in android I'm trying to make an application for
I am trying to get the current location whenever required and stop updating locations
I am trying to get my current location using cllocationmanager. Problem: The delegate method

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.