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??