1

I'm getting a peculiar warning, specifically this one:

warning: class does not implement the 'UIWebViewDelegate' protocol

... when I have these methods in my application:

-(void)webViewDidStartLoad {
    ...
}

-(void)webViewDidFinishLoad {
    ...
}

... and even after setting the UIWebView's delegate to self, I still get this warning, and the methods are never called (NSLog provides no results.)

Can anyone pinpoint what is happening here? Thanks in advance!

esqew
  • 42,425
  • 27
  • 92
  • 132

2 Answers2

3

I don't think your delegate methods are correct. Shouldn't they be:

- (void)webViewDidStartLoad:(UIWebView *)webView
{
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
}
No one in particular
  • 2,682
  • 2
  • 17
  • 20
3

As '@No on in particular' says, your methods aren't declared correctly. That is why the methods aren't called at all.

The warning has a different reason. It is because your interface definition doesn't declare that it implements the UIWebViewDelegate protocol.

@interface MyClass : NSObject <UIWebViewDelegate> {
...
}
...
@end

Whether or not the interface declares the protocol or not is actually of no consequence at runtime, it is just a hint to the compiler that allows it to issue warnings like the one you are seeing, or warnings if you don't implement the methods.

imaginaryboy
  • 5,979
  • 1
  • 32
  • 27