Helper objects
In Chapter 26, you used an NSURLConnection to fetch data from a web server. This connection was synchronous – all the data was delivered at one time. It worked fine, but there are two problems with a synchronous connection:
-
It blocks the main thread while waiting for all the data to arrive. If you use this type of connection in an interactive application, the user interface will be unresponsive while the data was fetched.
-
It has no way to call back if, for example, the web server asks for a username and password.
For these reasons, it is more common to use an NSURLConnection asynchronously. In an asynchronous connection, the data comes in chunks rather than all at once. This means that there are connection-related ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access