等了10秒后没能回来。主运行循环模式:kCFRunLoopDefaultMode

时间:2014-09-09 11:06:16

标签: ios nsurlconnection

我在退出应用程序时以及在启动应用程序时根据时间戳对服务器进行多次调用。基本上我拉动并推送数据。

我正在对服务器进行异步调用

但是发生的事情是我在调试控制台中收到此消息

  

void SendDelegateMessage(NSInvocation *):delegate   (web视图:decidePolicyForNavigationAction:请求:帧:decisionListener :)   等了10秒后没能回来。主运行循环模式:   kCFRunLoopDefaultMode

我的应用程序挂了。我不明白出了什么问题。

此致 兰吉特。

1 个答案:

答案 0 :(得分:1)

尝试将作品分成2件。运行异步的后台任务和应该在主队列中运行的部分。

DispatchQueue.global(qos: .background).async {

  // do things which can run in background
  // calculations-delay-waiting for a response etc.

  DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: {

    // implement UI related part which has to run in main thread.

  })
}