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 7608773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:00:18+00:00 2026-05-31T01:00:18+00:00

I have a mapView outlet on my view (MKMapViewDelegate) with Shows user location enabled.

  • 0

I have a mapView outlet on my view (MKMapViewDelegate) with “Shows user location” enabled.

In the viewdidload for that controller I have

CLLocation *userLoc = mapView.userLocation.location;
CLLocationCoordinate2D userCoordinate = userLoc.coordinate;
NSLog(@"user latitude = %f",userCoordinate.latitude);
NSLog(@"user longitude = %f",userCoordinate.longitude); 
mapView.delegate=self;

The simulator shows the correct user location on the map (I’m using Custom location in the IOS Simulator)

But the NSLog shows 0 and 0 for latitude and longitude.

Shouldn’t I be able to get the custom longitude and latitude in the simulator?

UPDATE WITH ANSWER:

Needed to implement

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    self.mapView.centerCoordinate = userLocation.location.coordinate;
} 
  • 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-05-31T01:00:19+00:00Added an answer on May 31, 2026 at 1:00 am

    Location services aren’t instantaneous. Your code is in viewDidLoad, so it hasn’t had a chance to get a fix on your position yet. You should set the delegate property for the map view to an object that implements the MKMapViewDelegate protocol.

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

Sidebar

Related Questions

I have a simple mapview that has the following viewdidload method and didupdate to
I have a mapview where I want to track the user's current location. GPS
I'm developing on an app that is location-based, I have a mapView set to
In my viewDidLoad: method I have set the MapView like this so that if
I have a FrameLayout view which contains one (MapView-like) control and some additional buttons
i have a mapView with pins on it, and the following code for CLLocation
I have a mapview and i put an annotation which shows a custom title
I have a mapview with many annotations on it. When the user clicks on
Is there a way to have the MapView not show my current location? I'm
I have a mapView that has annotation added through JSON (feed is stored 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.