- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的代码和我尝试调用 reverseGeocodeLocation 的完整上下文:
CLLocationCoordinate2D touchMapCoordinate =
[self.mapView convertPoint:touchPoint toCoordinateFromView:self.mapView];
CLLocation *destination = [[CLLocation alloc] initWithLatitude:touchMapCoordinate.latitude longitude:touchMapCoordinate.longitude];
__block CLGeocoder *destinationPin = [[CLGeocoder alloc] init];
__block NSString *destinationPinName;
[destinationPin reverseGeocodeLocation:destination completionHandler:^(NSArray *placemarks, NSError *error) {
if (error){
NSLog(@"Geocode failed with error: %@", error);
return;
}
if(placemarks && placemarks.count > 0)
{
CLPlacemark *topResult = [placemarks objectAtIndex:0];
NSString *addressTxt = [NSString stringWithFormat:@"%@ %@,%@ %@",
[topResult subThoroughfare],[topResult thoroughfare],
[topResult locality], [topResult administrativeArea]];
destinationPinName = [[NSString alloc] initWithString:addressTxt];
}
}];
annotation = [[MQAnnotation alloc] initWithTitle:destinationPinName andCoordinate:touchMapCoordinate];
我在函数入口点、函数的两个 if block 内以及我分配注释的函数之后设置了断点。当我到达 reverseGeocodeLocation block 时,destinationPin 具有有效值,但我的程序一直直接跳转到函数调用后设置的断点。任何想法可能会发生什么??
最佳答案
reverseGeocodeLocation
的执行是异步完成的。当该后台任务完成时,将调用您的完成 block 。所以你看到的是正确的行为。对 reverseGeocodeLocation
的调用会立即返回,远早于它完成并且远早于您的完成处理程序被调用。您需要更新代码,以便在完成处理程序中创建注释。
关于iphone - 尝试调用 reverseGeocodeLocation,但程序一直跳过函数调用。有任何想法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13013076/
我有一个在 Android 市场上相当流行的应用程序,它允许数以万计的用户按下一个按钮并向它发出语音命令。然后我就可以做很多不同的事情,比如给他们提供当前的天气预报等等...... 无论如何,我的应用
令人惊讶的是,标题基本上解释了它。我们有一个我们的客户制作的页面,我们正在重新创建该页面。 页面高度会一直增加,直到(我假设是这样)浏览器达到它的极限。我已经尝试过 Firebug 和 W3 验证器,
我是 react-native 的新手,试图创建我自己的组件,但它一直显示一个空屏幕。 这是我的组件代码 class BoxComponent extends Component { cons
我正在为我的 PHP 元素创建一个非常简单的博客,但遇到了一个简单的问题。我无法让我的页眉图像一直 float 。我有一个横幅,左边有一些文字,我有一个 1px 的切片,在可以选择的任何分辨率的宽度上
为什么我可以在另一个 Controller 的 View 中访问一个 Controller 的辅助方法?有没有办法在不破解/修补 Rails 的情况下禁用它? 最佳答案 @George Schreib
我正在使用带有最新 ADT 插件的 Eclipse Kepler SP2。每隔一分钟 Eclipse 就会说“为 Android 4.4.2 加载数据”并阻止我想做的一切。我在不同的文件夹中有几个 E
我是一名优秀的程序员,十分优秀!