iOS - warning on a webview: Assigning to 'id<UIWebViewDelegate>' from incompatible type

ios, uiwebview

Solution

Your View controller most likely does not implement the UIWebViewDelegate protocol. Even if it has the methods, you probably don't have it in your interface declaration. It should look like:

@interface YourViewController : UIViewController <UIWebViewDelegate>

Problem

I have this code. the reference to theWebView is a WebView element that I put on the page. I have this code: ``` - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor = [UIColor colorWithWhite:0.859 alpha:1.000]; theWebView.delegate = self; } ``` And I get a warning on this line: ``` self.view.backgroundColor = [UIColor colorWithWhite:0.859 alpha:1.000]; ``` saying: ``` Assigning to 'id<UIWebViewDelegate>' from incompatible type 'BalanceSheetController *const_strong' ``` Would anyone know why this warning happens? without that line, clicks on links on the UIWebView do not get recognized. Thanks!

Original source