I have a NSURLConnection which carries out the task of uploading images for me. This is how I initialize and start this connection:
_connection = [[NSURLConnection alloc]
initWithRequest:request
delegate:self
startImmediately:NO];
[_connection scheduleInRunLoop:[NSRunLoop mainRunLoop]
orMode:NSDefaultRunLoopMode];
[_connection start];
I actually call this method from somewhere else with dispatch_async
on its own dispatch_queue.
The problem is when an image is uploading and I start typing in my app with keyboard, sometimes, it freezes the application.
After a bit of digging I came to understanding that the mainRunLoop
is actually what handles input requests such as keyboard button press. I wanted to know if I get it right and this is what actually causing my problem which is freezing my app.
Any help regarding this issue is much appreciated.
Thank you in advance.
P.S: I tried running my connection on currentRunLoop but it doesnt work unless I manually start the currentRunLoop.