![](/img/trans.png)
[英]Assigning to 'id<UITextFieldDelegate> _Nullable' from incompatible type 'HomeDataForm *const __strong'
[英]Assigning to 'id<UIWebViewDelegate> _Nullable' from incompatible type 'WebView *const __strong'
當我添加webView.delegate = self; 通過以下代碼訪問網絡視圖
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height-64)];
NSString *htmlFile = [[NSUserDefaults standardUserDefaults] objectForKey:USER_CODE];
NSLog(@"Value retured : %@",htmlFile);
NSURL *url = [NSURL URLWithString:htmlFile];
webView.delegate = self;
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[self.view addSubview:webView];
}
我收到以下錯誤。
/Applications/MAMP/htdocs/iOS/SchoolApp/test/WebView/WebView.m:25:22: Assigning to 'id<UIWebViewDelegate> _Nullable' from incompatible type 'WebView *const __strong'
您的View控制器未實現UIWebViewDelegate協議。請勿在類的接口聲明中使用它
@interface YourViewControllerName : UIViewController <UIWebViewDelegate>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.