Type Method


Attempts to register a subclass of NSURLProtocol, making it visible to the URL loading system.


+ (BOOL)registerClass:(Class)protocolClass;



The subclass to register.

Return Value

YES if the registration is successful, NO otherwise. The only failure condition is if protocolClass is not a subclass of NSURLProtocol.


Register any custom NSURLProtocol subclasses prior to making URL requests. When the URL loading system begins to load a request, it tries to initialize each registered protocol class with the specified request. The first NSURLProtocol subclass to return YES when sent a canInitWithRequest: message is used to load the request. There is no guarantee that all registered protocol classes will be consulted.

Classes are consulted in the reverse order of their registration. A similar design governs the process to create the canonical form of a request with canonicalRequestForRequest:.

See Also

Registering and Unregistering Protocol Classes

+ unregisterClass:

Unregisters the specified subclass of NSURLProtocol.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software