Skip to content Skip to sidebar Skip to footer

Loading Annotations From Url Using Background Thread. Pins Doesn't Show Before Moving Or Scaling Mapview

I load annotations from url using background thread. Pins doesn't show before I move or scale mapView. How can I update my view? My viewDidAppear - (void)viewDidAppear:(BOOL)animat

Solution 1:

You are updating the UI from a non UI - Thread this will not work

You will have to call segments of code that update your ui inside the UIThread Block as following:

For example

[mapView removeAnnotations:annotationsOnMap];

must be called in UI-Thread

dispatch_async(dispatch_get_main_queue(), ^{
        //Update UI if you have to[mapView removeAnnotations:annotationsOnMap];
    });

Please note that you have to call all your UI updates inside the main_queue thread

dispatch_async(dispatch_get_main_queue(), ^{
        //All UI updating code must come here
    });

Post a Comment for "Loading Annotations From Url Using Background Thread. Pins Doesn't Show Before Moving Or Scaling Mapview"