开发者

how to find if mapkit failed to get userlocation?

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜