Type Method 型メソッド

registerClass:

Attempts to register a subclass of NSURLProtocol, making it visible to the URL loading system. NSURLProtocolのサブクラスの登録を試みます、それがURLローディングシステムに見えるようにします。

Declaration 宣言

+ (BOOL)registerClass:(Class)protocolClass;

Parameters パラメータ

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. YES、もし登録がうまくいくならば、そうでなければNO。唯一の失敗条件は、protocolClassNSURLProtocolの下位クラスでない場合です。

Discussion 議論

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. すべてのあつらえのNSURLProtocolサブクラスをURLリクエストをする前に登録してください。URLローディングシステムがあるリクエストのロードを開始する時、それは各登録されたプロトコルクラスをその指定のリクエストで初期化しようと試みます。まずcanInitWithRequest:メッセージを送信した時にYESを返すNSURLProtocolサブクラスがそのリクエストをロードするために使われます。全ての登録されたプロトコルクラスが考慮に入れられる保証はありません。

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:. クラスは、それら登録の受け取り順で考慮に入れられます。同様の設計は、リクエストの正準形式をcanonicalRequestForRequest:で作成する過程を左右します。

See Also 参照

Registering and Unregistering Protocol Classes プロトコルクラスの登録および登録解除