iOS actualisation des annotations sur les mapview

J'ai une mapview où l'annotation coordonnées sont constamment mis à jour, mais lorsque j'utilise setCoordinate, l'annotation ne bouge pas. Comment puis-je actualiser les annotations afin de refléter leurs coordonnées?

- (void)updateUnits {

    PFQuery *query = [PFQuery queryWithClassName:@"devices"];
    [query whereKeyExists:@"location"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {

        if (!error) {

            for (PFObject *row in objects) {

                PFGeoPoint *geoPoint = [row objectForKey:@"location"];
                CLLocationCoordinate2D coord = { geoPoint.latitude, geoPoint.longitude };

                for (id<MKAnnotation> ann in mapView.annotations) {

                    if ([ann.title isEqualToString:[row objectForKey:@"deviceid"]]) {

                        [ann setCoordinate:coord];

                        NSLog(@"latitude is: %f" , coord.latitude);
                        NSLog(@"Is called");
                        break;
                    }
                    else {

                        //[self.mapView removeAnnotation:ann];
                    }
                }
            }
        }
        else {

        }
    }];
}
Cela peut être fait en changeant juste les coordonnées de l'objet de l'Annotation. Il ne nécessite pas l'annotation à supprimer, puis ajouté à la carte pour que les changements entrent en vigueur

OriginalL'auteur Jon Erickson | 2013-01-03