views:

58

answers:

2

Hi all,

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!

+3  A: 

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
Sorry, big typo when transferring to SO... I have these in my source code.
esqew
+3  A: 

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
Thanks, this silenced the error, and now the calls are going through.
esqew