Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Hour 14. Accessing the Network > Using Cocoa Touch to Access the Web

Using Cocoa Touch to Access the Web

You’ll be glad to hear that Cocoa Touch provides a lot of support for accessing the network using HTTP. It manages the TCP protocol, the HTTP protocol, pipelining, multiple connections, caching, and cookie handling for you. You just need to know what to ask it to do. Its NSURL class simplifies manipulating URLs. Its NSURLRequest class represents a request you can send to the server. The NSURLConnection class sends requests to the server and gathers the responses.

Using NSURL

The NSURL class constructs and parses URLs. NSURLs are either created directly from a string (initWithString:); created from a scheme, host, and path (initWithScheme:host:path:); created from a path relative to an existing URL (initWithString:relativeToURL:); or created from a local file path (initFileURLWithPath and initFileURLWithPath:isDirectory:). For convenience, these methods have autoreleased variants.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint