I have a webview in which I want to invoke Obj-C Code, I do it like in thisTutorial
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSString *absoluteUrl = [request.URL absoluteString];
NSLog(@"STRING: %@",absoluteUrl);//prints out didTap://button1
NSString *sayHello = @"didTap://button1";
if ([sayHello isEqualToString: absoluteUrl]) {
[self sayHello];
return NO;
}
return YES;
}
however [self sayHello] is never being invoked. Anybody knows why?
Looks like there are trailing spaces or other white characters involved. That would explain the inequality.
Also, you should perhaps use the standard method of
NSURL:To remove spaces, do this: