I'm trying to detect if a specific url is being loaded in a uiwebview and if so redirect the webview to a different url. So far I've got the following code which should seem to work for me but no luck so far, anyone know what I'm doing wrong:
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if(request.URL == [NSURL URLWithString:@"https://cheese.com/"])
{
NSURL *url = [NSURL URLWithString:@"https://example.com/"];
[self.webView loadRequest:[NSURLRequest requestWithURL:url]];
} else {
}
return YES;
}