我的代碼存在語義問題。我有一個UIWebView,我添加了一條錯誤消息,所以如果沒有互聯網連接,彈出一個錯誤。setDelegate上的語義問題
這是我的一個UIWebView的編碼在我的.m文件
- (void)viewDidLoad {
[super viewDidLoad];
NSString *fullURL = @"http://example.com";
NSURL *url = [NSURL URLWithString:fullURL];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[website setDelegate:self];
[website loadRequest:requestObj]; }
的錯誤是在此代碼
[website setDelegate:self];
它說,它是一個語義問題和錯誤發送FirstViewController * const_strong參數不兼容類型編號
這裏是錯誤消息的代碼,如果沒有互聯網連接
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error" message:@"error connecting to the internet" delegate:self
cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show]; }