IPhone SendDelegateMessage failed to return after waiting 10 Secs

China☆狼群 提交于 2019-12-07 07:33:52

问题


I keep getting the following message from my iPhone 3.0 when trying to convert a large NSData object into base64Encoding for http transmission :

void SendDelegateMessage(NSInvocation*): delegate failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

If you were not using the touch screen for this entire interval (which can prolong this wait), please file a bug.

I am using synchronous request and touch screen will be frozen with only UIProgressView displaying status while uploading data. Anyone have any good idea how to resolve this problem ?


回答1:


As it says: you take too long ;D
web view to english: " i called a delegate and it takes too long and I can't continue displaying HTML or running JS"

don't block the web view or it will complain after a while...

so doing a synchronous request? on the main thread? never do that

Better way:

- webView:... {
      dispatch_async(dispatch_get_global_queue(0,0), ^{
          //DO LONG RUNNING IN BG

          dispatch_sync(dispatch_get_main_queue(), ^{
              //update UI
          }
      }
}



回答2:


If you are using the UIWebView then we need to do this first before moving to the next view

webView.delegate = nil;


来源:https://stackoverflow.com/questions/1618727/iphone-senddelegatemessage-failed-to-return-after-waiting-10-secs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!