title: Registering a custom NSUrlProtocol in MonoTouch
body: <p>I am building an iOS app using MonoTouch and attempting to implement a custom NSUrlProtocol. </p>
  
  <p>When I register my own protocol implementation, I get the following error:</p>
  
  <blockquote>
    <p>WebKit discarded an uncaught exception in the
    webView:decidePolicyForNavigationAction:request:frame:decisionListener:
    delegate:  <em>*</em> -canInitWithRequest: only
    defined for abstract class.  Define
    -[Foo.Network.NetworkServices+TestProtocol canInitWithRequest:]!</p>
  </blockquote>
  
  <p>Any thoughts on what could be causing this?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>//Registering the protocol    
  NSUrlProtocol.RegisterClass(new Class(typeof(TestProtocol)));
  
  public class TestProtocol : NSUrlProtocol
  {
      public TestProtocol ()
      {
          this.Client = new TestProtocolClient(); 
      }       
  
      public override bool CanInitWithRequest (NSUrlRequest request)
      {
          return true;
      }
  }
  
  public class TestProtocolClient : NSUrlProtocolClient
  {
      public override void DataLoaded (NSUrlProtocol protocol, NSData data)
      {
      }
  
      public override void FailedWithError (NSUrlProtocol protocol, NSError error)
      {
      }
  
      public override void ReceivedResponse (NSUrlProtocol protocol, NSUrlResponse response, NSUrlCacheStoragePolicy policy)
      {
      }
  
      public override void Redirected (NSUrlProtocol protocol, NSUrlRequest redirectedToEequest, NSUrlResponse redirectResponse)
      {
      }
  
      public override void CachedResponseIsValid (NSUrlProtocol protocol, NSCachedUrlResponse cachedResponse)
      {
      }
  
      public override void FinishedLoading (NSUrlProtocol protocol)
      {
      }
  
      public override void ReceivedAuthenticationChallenge (NSUrlProtocol protocol, NSUrlAuthenticationChallenge challenge)
      {
      }
  
      public override void CancelledAuthenticationChallenge (NSUrlProtocol protocol, NSUrlAuthenticationChallenge challenge)
      {
      }
  }
  </code></pre>