3 ms·
> - STHTTPRequest must be used from the main thread > - Success block and error block are called on main thread Those seem like two quite irritating limitatio
by richardwhiuk 12y ago
> - STHTTPRequest must be used from the main thread
> - Success block and error block are called on main thread
Those seem like two quite irritating limitations - anyone know the rationale behind them?
- deleted 12y ago[deleted]
- faizanaziz 12y agowhy is that irritating.... Thats a good thing... There is no confusion of what is happening... When there is async code the expectation is CODE CODE [start_block { LATER - excuted in main thread }] CODE Otherwise you write a ton of code with get_main_thread
- ttflee 12y agoBecause STHTTPRequest was using NSURLConnection, which was scheduled to the Main Run Loop. You can have it on threads other than the main run loop, but you have to create the thread and kick off the run loop yourself, and manage it afterwards. On the main thread, you can always get a running run loop, the main run loop, for free.