By default, iOS URL Loading System supports the following schemes:

  • _ftp:// _for File Transfer Protocol
  • _http:// _for Hypertext Transfer Protocol
  • _https:// _for Hypertext Transfer Protocol with encryption
  • _file:// _for local file URLs
  • _data:// _for data URLs

URL Loading System

Desc

A set of classes known as theURL Loading System, handles URL requests. You need to know them to find out how iOS handles your app’s requests to load a URL-based resource.

Mechnism

At the heart of the URL Loading System is theNSURLclass. For network requests, this class tells what host your app is trying to reach and path to the resource at that host. In addition theNSURLRequestobject adds information like HTTP headers, the body of your message, etc.. The loading system provides a few different classes you can use to process the request, the most common beingNSURLConnectionandNSURLSession.

When you receive a response it comes back in two parts: metadata and data. The metadata is encapsulated in aNSURLResponseobject. It will tell you the MIME type, the text encoding (when applicable), the expected amount of data of your response and the URL that is the source of the information. The data arrives asNSDataobjects.

Behind the scenes, when the loading system downloads information using aNSURLRequest, it will create an instance of aNSURLProtocolsubclass, which represents your custom URL protocol.NSURLProtocolis an abstract class that exists only to be extended in this way. You should never instantiate anNSURLProtocolobject directly.

results matching ""

    No results matching ""