1

i'm trying to show the user location in my app and it shows the user location in the middle of the ocean , i tried it both on real device and on the simulator.

when the user touch the location button this function is running :

CLLocationCoordinate2D userLocationCoordinate = _mapView.userLocation.location.coordinate;

NSLog(@"user latitude is: %f", userLocationCoordinate.latitude);
NSLog(@"user longitude is: %f", userLocationCoordinate.longitude);

MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocationCoordinate, 1000.0, 1000.0);
[_mapView setRegion:region animated:YES];
_mapView.showsUserLocation = YES;


NSLog(@"showing user current location");

the log output is : 0.00000 and 0.00000

sometimes it's working (only worked on the simulator so far ) and it shows the location in the USA (apple headquarters or something).

any idea what's the problem is?

thanks!

OK I have solved the problem , it was the xcode 6 problem that is mentioned in the comments (thanks!) and I needed to cancel the simulate location in the app scheme.

but i have a new problem right now , the location manager wont ask the user to allow location services. I'm trying it on my IPhone 5s (IOS 7) and just when I manually turn on the location services for the app it is working.

any ideas??

Eilon Udi
  • 35
  • 2
  • 7
  • http://stackoverflow.com/questions/25844430/xcode-6-gm-cllocationmanager/25844674#25844674 check this did you make changes required for iOS8? – Bhumit Mehta Sep 27 '14 at 17:25
  • I'm using ios 7 but i have switched to xcode 6 now , it is asking me to allow location services , but it still wont show the location. any other ideas? – Eilon Udi Sep 27 '14 at 23:51

0 Answers0