私は、米国中の利用可能なユーザーに通話要求を送信し、その間にマップオーバーレイと進行状況バーを介して進行状況について通話送信者を更新するアプリケーションを作成しています。何らかの理由で、Grand Central Dispatch、CATransactionなどでどのようなトリックを試しても、マップとプログレスバーは最終ステップに更新されません。バックエンドにParseを使用しており、物体。
dispatch_queue_t main_queue = dispatch_get_main_queue();
PFQuery *repQuery = [PFQuery queryWithClassName:@"User"];
[repQuery getObjectInBackgroundWithId:[_currentCallObject objectForKey:@"Rep"] block:^(PFObject *repUser, NSError *error) {
PFGeoPoint *repLocation = [repUser objectForKey:@"location"];
dispatch_async(main_queue, ^{
CLLocationCoordinate2D coordinates[2];
coordinates[0] = _repMapView.userLocation.coordinate;
coordinates[1] = CLLocationCoordinate2DMake(repLocation.latitude, repLocation.longitude);
MKPolyline *route = [MKPolyline polylineWithCoordinates:coordinates count:2];
MKCircle *circle1 = [MKCircle circleWithCenterCoordinate:coordinates[0] radius:40000];
MKCircle *circle2 = [MKCircle circleWithCenterCoordinate:coordinates[1] radius:40000];
[_repMapView addOverlay:circle1];
[_repMapView addOverlay:circle2];
[_repMapView addOverlay:route];
[_repMapView setNeedsDisplay];
[_callProgressView setProgressToStep:4];
[CATransaction flush];
});
}];
進行状況ビューは別の.mファイルに含まれていますが、オーバーレイは同じ.mファイルに描画されます。
- (MKOverlayView *)mapView:(MKMapView *)map viewForOverlay:(id <MKOverlay>)overlay
{
// MKCircle and MKPolyline handled here
}
また、次のすべてをヘッダーファイルに入れます。MKMapViewDelegate、MKAnnotation、MKOverlayまた、_repMapView.delegate = self; マップビューの初期図面で設定されました。
UIがリアルタイムで更新されない原因となっている明らかな何かがここにありませんか?
ありがとう。