简体   繁体   English

可达性运行时错误-SCNetworkReachabilitySetDispatchQueue()失败:权限被拒绝

[英]Reachability Runtime error - SCNetworkReachabilitySetDispatchQueue() failed: Permission denied

Here is my code: 这是我的代码:

Reachability *r = [Reachability reachabilityWithHostname:host];    
r.reachableBlock = ^(Reachability*reach)
{
    // Update the UI on the main thread

    });
};    
r.unreachableBlock = ^(Reachability*reach)
{
    // Update the UI on the main thread with error alert

    });
};    
[r startNotifier]; 

Upon running the last statement, I get following error logged, and it never executes any of the reachableBlock or unreachableBlock . 运行最后一条语句后,我记录了以下错误,并且它从不执行任何reachableBlockunreachableBlock

 SCNetworkReachabilitySetDispatchQueue() failed: Permission denied

For anyone wanting to know what I tried already, I also attempted this: 对于想知道我已经尝试过的人,我也尝试过这样做:

dispatch_async(dispatch_get_global_queue(0,0), ^{
    [r startNotifier];
});

But this yields same result. 但这会产生相同的结果。 I logged an issue here . 在这里记录了一个问题。

This is no longer an issue. 这不再是问题。

By some mysterious reasons, I cleaned up build folder, reset iOS simulator, relaunched it and recompiled - and the error is gone. 由于某些神秘的原因,我清理了构建文件夹,重置了iOS模拟器,重新启动并重新编译-错误消失了。 I didn't succeed following these steps at first, but doing them just for the sake of trying, and it worked! 首先,我没有成功完成这些步骤,但只是为了尝试而进行这些操作,它确实奏效了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM