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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:45:31+00:00 2026-06-15T07:45:31+00:00

So I am building a location based game and have a problem getting a

  • 0

So I am building a location based game and have a problem getting a users location to initialize properly.
It doesn’t always happen, but sometimes the location never changes from 0,0.

This causes a problem as I have a loading view (vault) that blocks the map from being displayed until the player’s location is loaded and not 0,0. So if the user location doesnt get set, the vault never opens showing the map.

Is there any other way to ensure the user location is loaded?
FYI – I already ensure they have location services enabled and their device is capable.
I am having this issue on and off on my own devices with everything enabled properly.

ViewDidLoad:

/*Location Manager*/
locationManager = [[CLLocationManager alloc] init]; 
locationManager.delegate = self; 
[locationManager setDistanceFilter:100.0];//Update location to network when player moves X meters
[locationManager setDesiredAccuracy:kCLLocationAccuracyKilometer];//Nearest 1000 meters (.33 miles)
[locationManager startUpdatingLocation];

/*Map View*/
mapLoaded = false;
currentFilter = 0;
[_mapView setDelegate:self];
[_mapView setShowsUserLocation:YES];
[_mapView setMapType:MKMapTypeSatellite];

Location Manager Delegate:

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    //Wait until User Location is initialized (NOT 0,0)
    NSLog(@"Latitude: %f, Longitude: %f",_mapView.userLocation.coordinate.latitude,_mapView.userLocation.coordinate.longitude);
    if(_mapView.userLocation.location.coordinate.latitude!=0.00 && _mapView.userLocation.location.coordinate.longitude!=0.00){

        //Update Player Object
        [player setLatitude:_mapView.userLocation.location.coordinate.latitude];
        [player setLongitude:_mapView.userLocation.location.coordinate.longitude];

        [player updatePlayerLocation];//Update location to network
        if(mapLoaded){//Map already loaded, call refresh
            [self refreshMap];
        }
        else{//First load of map
            [_mapView setCenterCoordinate:_mapView.userLocation.location.coordinate];
            [self populateMap];
            [self openVault];
            mapLoaded = true;//Disable map first load
            //timerMap = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(refreshMap) userInfo:nil repeats:YES];//Auto-Refresh of Map
        }
    }
}
  • 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-15T07:45:32+00:00Added an answer on June 15, 2026 at 7:45 am

    You seem to be trying to get the location from the _mapView.userLocation CLLocation object.

    You should rather use the last item in the locations array passed into your method.

    see also documentation, guide with snippets

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

Sidebar

Related Questions

I am currently building a location-based service that calculates routes for users sharing cars
A bit of background info: I am building a geolocation based game for Android
I am in the process of building a location-based iPhone app and I am
I'm building a web application for location-based check ins, sort of like a local
We are building a location based messaging app which uses Parse.com as back-end (Parse.com
I'm looking at building a simple app based around location. Obviously given that lots
I'm building an app which displays result data based on your current location. At
I'm building a location-based web app that will run primarily on mobile browsers. It
We are building a service that uses location-based pricing. The user can input an
I'm building a huge database of IP addresses with their geographic location attached (country,

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.