Just found in Apple docs:
Note: Although good for occasional communication between threads, you should not use the
performSelector:onThread:withObject:waitUntilDone:
method for time critical or frequent communication between threads.
Why is it so? How much is "frequent"?
I have an app with a lot of threads and a lot of stuff happening in main thread (heavy JavaScript, frequent Ajax queries in a WebKit). On Yosemite, I started to experience huge problems in combination of several (say, 10) file downloads (NSURLDownload
s) plus the WebKit GUI (required to run in the main thread).
File downloads cannot "live" long with a WebKit heavily loaded by JavaScript. At some point, all network requests start returning timeout (error -1001) until the app quits.
And I widely use performSelector:onThread:withObject:waitUntilDone:
, e.g. to notify UI about the download progress. This can happen many times per second. Can it be the problem?
P.S. Unfortunately, I'm not allowed to show the whole source code...