views:

141

answers:

1

I want to find that if mapkit failed to get user location(fails to show blue blob at user location) and show alert and then relocate the location again.i don't want to use corelocation.plz help me.

A: 

You might try to use the delegate methods that gets called to see if the blue dot is being asked for:


- (MKAnnotationView *) mapView: (MKMapView *)aMapView viewForAnnotation: (id )annotation 
{      
    if (annotation == aMapView.userLocation) 
    {
     return nil; // this might be the moment the location was first detected
    }
}

You could assume that the blue dot is only asked for after the location is known to map kit. However, I think this would not be a good idea as those things might easily break in the next version of the SDK.

I would recommend to use Core Location. It is relatively easy to use and gives you all the flexibility and stability over the long run.

Sascha Konietzke
but if i use core location i'm unable to show default blue blob,because we cannot set location cordinates of blue blob
Rahul Vyas
You can use the blue dot on mapkit and use your own core location code at the same time. If you would like to allow the user to drag the blue dot for example just add a custom annotation, make it look like the blue dot, and hide the original blue dot.
Sascha Konietzke
but we can not set location of blue blob
Rahul Vyas
I think you cannot set the location of the blue dot (userLocation) of mapkit to any position you like. Just set mapView.showsUserLocation = NO; and then use a custom annotation with a custom annotation view. You can style the custom annotation view any way you want, so you can also make it a blue dot that looks exactly like the default blue dot. No user will notice the difference and you can set your custom blue dot to the user's location or any other location you want to.
Sascha Konietzke