NSURLProtocol is both the most obscure and the most powerful part of the URL Loading System. It's an abstract class that allows subclasses to define the URL loading behavior of new or existing schemes.
- Intercepting HTTP requests to serve images locally from the app bundle resources, if available
- Signing outgoing streaming media requests
- Creating a proxy server for a local data transformation service with a URL request interface
- Introducing custom schemes (e.g. myapplocalfile://myfile.gif) and intercept them
Even the UIWebView class makes request using the default iOS URL Loading System, so you might use custom scheme inside HTML, creating an NSURLProtocol and deliver the response from a local file.
Comments
Post a Comment