MKMapView userLocation not showing in ipod - iphone

i used
self.mapView.showsUserLocation = YES;
for showing blue dot (circle) on MKmapview. Its working fine in simulator. but when i tested in Ipod, its not showing. Anybody know what will be the reason ? thanks in advance

If the blue circle doesn't show in Maps either, than your local wifi networks aren't in the system (on the iPod your locationis determined by the nearest wifi ssid's). Two solutions: get them listed (not sure where you can do that) or go somewhere where it does work. In the iPhone Simulator you get a simulated location, so not so interesting that it works.
If you get the blue circle in Maps but not in your map, we can look further at it.

Is the iPod on the same, wireless network with location services enabled?

Check if u have given the delegates --->map.delegate=SomeController;
-(void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark;
and
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error;

Related

stopUpdatingLocation is not working in iOS 7

I have developed both iPhone & iPad application which supports for iOS 5 and iOS 6
in that application i have grabbed user current location using CLLocationManager.
when i want to stop updating receiving GPS coordinates. I have called stopUpdatingLocation
method to stop calling didUpdateToLocation method. It was woking completely fine with iOS 5 and 6 But unfortunately its not working with iOS 7.
Seems that stopUpdatingLocation method is not working .Any particular reason. ??
i had a keep a variable to monitor the life cycle of didUpdateToLocation method and stop executes it.
One thing might be possible is,
Your current location blue dot moving on your map is because you set the MKMapView's showsUserLocation to YES. It will track until you set it to NO.
Second thing,
You might be setting below thing to stop calling that method
locationManager = nil;
That does not stop monitoring, but what it does, not to refer the location manager, So now its not possible to stop monitoring.
Instead add below code & then see what happen
[locationManager stopUpdatingLocation];
locationManager=nil;
Hope it helps..
#tdevoy - Here is sample
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *location = [locations lastObject];
latitude = location.coordinate.latitude;
longtitude = location.coordinate.longitude;
//stops updating current user location update
[locationManager stopUpdatingLocation];
}

MKMapView setRegion:Animated: work on simulator but not on device iOS6

I have an MKMapView. To change the displayed region I use
[self.mapView setRegion:region animated:YES];
The strange is that on simulator the region is changed with animation, but on device the change is immediate and not animated.
I change the region after a long tap on the map...
This behavior drive me crazy and I can't able to solve it...
Thanks...
You need to slow down setRegion by using the following code
[self performSelector:#selector(setMapRegion) withObject:nil afterDelay:3.0];
-(void) setMapRegion
{
[self.mapView setRegion:region animated:YES];
}
If you load the map on device and iOS 6+ you'll experience a bit of delay till the tiles are loaded so the best thing to do is to try delaying the region change.
The map is not responsive even you set the animation it won't appear that clearly to you,it would look like it's not making any animation.
MKMapView calls its delegate method mapViewDidFinishLoadingMap: once the map has loaded all the necessary tiles and is ready to use. You should call setRegion:animated: there.

MKMapView crash on showUserLocation on iOS6

I just recently updated my iOS SDK to the latest release (6.0).
I used to have a couple of map views in my app, MKMapView, that were
used to show the user location.
After the update, upon setting the property
mapView.showUserLoaction = YES;
The app crashes with the following exception:
-[MKCoreLocationProvider locationManager:didUpdateToLocation:fromLocation:]: unrecognized
selector sent to instance 0x155af5f0
This happened on iPhone iOS 6.0 Simulator, not on device/simulators with previous versions of the OS.
The error can be reproduced just by setting the property. Otherwise the app run smooth.
The bug came up just after updating the SDK. Moreover, I didn't test on a iOS 6 device yet (all the test on such a device have been performed with the previous version of the SDK though, and the app didn't crash).
What could be the issue?
UPDATE: in iOS6 Device there are no issues. The problem appears just on the iOS 6 Simulator
Have you tried ?
[mapView setShowsUserLocation:YES];
if you are using a MKMapViewYou should also be using if you are doing something with the userlocation
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
}
I am using this delegate method and this is working fine for me in ios6
-(void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations
{
}

How to recenter map in iPhone app on zoom in/out using MKMapView

I am developing an iPhone application in which I need to show an image at a specific Latitude & Longitude on a Map. The requirement is - Even if the user zooms in or out on this map screen, the map control should automatically center itself after the zoom, to the same Lat & Long. I am using MKMapView.
I have tried to go through all available documentation. However, I could not come across any callback or other method that will allow me to achieve the objective.
One alternative is to handle touch events. However, I find that as a very complicated solution. And I hope that a simpler alternative exists. Any ideas on the above?
Can you please help? Any example will be appreciated.
Implement MKMapViewDelegate and then try this:
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
[mapView setCenterCoordinate:locationManager.coordinate animated:NO];
}
Replace locationManager with whatever the name of your CLLocationManager is.

MKMapView didUpdateUserLocation not updating

I have an application with map and want to zoom to the current location, when it's updated.
I use -(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation delegate method to know when user location was updated.
Now on simulator method is being called as it should. But when i test it on device (iphone 2g) the location is updated on map, but "didUpdateUserLocation" method is not being called at all, same for delegate method "mapViewWillStartLocatingUser".
The system asks if I allow to get my location for app and starts showing my location, but
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
NSLog(#"didUpdateUserLocation = '%#'", userLocation);
}
is never called.
Reference mentions that this delegate method is available since iOS 4.0. Your simulator is most probably running iOS 4.0 while your phone - iOS 3.1.
I'm having the same problem and still looking for solution. Perhaps accessing CL methods directly will help.
try this Map.showsUserLocation=YES;