NSURLProtocol is an abstract class that provides the basic structure for performing protocol-specific loading of URL data.
NSURLProtocol is available in iOS 2.0 and later with iOS and available in OS X v10.2 with Safari 1.0 installed ,available in OS X v10.2.7 and later with OSX.
An NSURLProtocol object handles the loading of protocol-specific URL data. The NSURLProtocol class itself is an abstract class that provides the infrastructure for processing URLs with a specific URL scheme. You create subclasses for any custom protocols or URL schemes that your app supports.
Apps never need to instantiate an NSURLProtocol subclass directly. When a download starts, the system creates the appropriate protocol object to handle the corresponding URL request. All you have to do is define your protocol class and call the registerClass: class method during your app’s launch time so that the system is aware of your protocol.
Source : NSURLProtocol Class Reference
NOTE
You cannot use this class to define custom URL schemes and protocols in watchOS 2 and later.