调用[CLLocationManager authorizationStatus]时出现意外延迟/滞后/冻结/阻塞

时间:2013-12-11 22:44:29

标签: ios iphone ipad ios7 location

我在主线程上为某些旧设备调用[CLLocationManager authorizationStatus]时偶尔会看到明显的UI冻结。这应该发生吗?我没有在文档中看到任何内容,表明这不仅仅是获取状态变量

文档:https://developer.apple.com/library/mac/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/clm/CLLocationManager/authorizationStatus

在运行iOS 7.0.4的iPhone 4S上出现问题

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。我仍然不知道这是什么原因,但我的快速解决方案是把它放到这样一个线程中:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
        // Do something...
    }
});

我希望这会有所帮助。