ios - 无法使用 geoPointForCurrentLocationInBackground 检索地理点

标签 ios objective-c parse-platform

我正在尝试检索当前用户的当前地理点,但是当我调用 geoPointForCurrentLocationInBackground: 时没有任何反应。我无法从 block 中记录 NSLog,但是另一个 NSLog 出现在控制台中。

- (IBAction)whereCurrentUser:(id)sender {

    [PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error) {
        if (geoPoint) {

            NSLog(@"GEOPOINT %@", geoPoint);

        }

        else

        {
              NSLog(@"ERROR");
        }
    }];
    NSLog(@"BUTTON TAPPED");
}

我还需要实现其他东西吗?文档非常清楚,因此我无法弄清楚可能是什么问题。

最佳答案

Parse.com PFGeoPoint.geoPointForCurrentLocationInBackground not doing anything 上发布了一个解决方案.基本上将 Parse 更新到最新版本并将 NSLocationWhenInUseUsageDescription 键添加到您的 Info.plist,这是在 iOS 8 中所做的更改,无论何时您想要在您的应用程序中使用用户位置都需要。

关于ios - 无法使用 geoPointForCurrentLocationInBackground 检索地理点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27649234/

相关文章:

ios - IPhone景观和肖像

ios - 无法从解析代码块中获取数组 PFQuery 对象

ios - 检索图像到我的 UIImageView

javascript - Parse.com Javascript 通过 facebook 注销

iphone - 嵌入 YouTube 视频

ios - 从 iOS 模拟器截屏并在 App Store Connect 中使用

ios - 类名方法?

iphone - CGPathAddEllipseInRect 的替代方案

objective-c - TestFlightApp 的问题

objective-c - UILabel 段落文字对齐