叫我面對此錯誤,而拉伸折線通過使用谷歌API終止應用程序由於未捕獲的異常GMSThreadExceptionGMSThreadException」原因:‘的API的方法必須從主線程’
-(void)drawRoute
{
dispatch_queue_t myQueue = dispatch_queue_create("My Queue",NULL);
dispatch_async(myQueue, ^{
[self fetchPolylineWithOrigin:origin destination:destination completionHandler:^(GMSPolyline *polyline)
{
dispatch_async(dispatch_get_main_queue(), ^{
// Update the UI
if(polyline)
polyline.map = mapView;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
});
}];
});
}