Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPhone SendDelegateMessage failed to return after waiting 10 Secs

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 ?

like image 733
Andrew Sky Avatar asked Nov 05 '22 19:11

Andrew Sky


1 Answers

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
          }
      }
}
like image 97
Daij-Djan Avatar answered Nov 12 '22 17:11

Daij-Djan