GCD and async NSURLConnection

前端 未结 4 1883
刺人心
刺人心 2020-12-04 17:03

I know that if I create an NSURLConnection (standard async one), it will call back on the same thread. Currently this is on my main thread. (work fine too).

But i\'m

4条回答
  •  再見小時候
    2020-12-04 17:25

    Just as an answer to why your thread was disppearing (and for future reference) the NSURLConnection needs a runloop. If you had added

    [[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantFuture]];
    

    You'd see that the connection runs properly and the thread doesn't disappear untill the connection was completed.

提交回复
热议问题