Hi,
I currently have a UIWebView at the bottom of my app that basically displays Google Adsense Ads.
What I would like to do is open Safari when a user clicks the ad in the webview.
I have already looked for that a lot, and the only thing I could find is a code like that :
So, when I add this to my code, I change the name "webView" by the name of what my UIWebView is ("pubadsense"), so it finally looks like that :
But when I want to compile, Xcode tells me :
What am I supposed to do now ?
Isn't the code I found working for this particular case ?
Thanks !
I currently have a UIWebView at the bottom of my app that basically displays Google Adsense Ads.
What I would like to do is open Safari when a user clicks the ad in the webview.
I have already looked for that a lot, and the only thing I could find is a code like that :
Code:
(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
[[UIApplication sharedApplication] openURL:request.URL];
return false;
}
return true;
}
So, when I add this to my code, I change the name "webView" by the name of what my UIWebView is ("pubadsense"), so it finally looks like that :
Code:
[pubadsense loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://adriweb.free.fr/pub.html"]]];
- (BOOL)pubadsense:(UIWebView *)pubadsense shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
[[UIApplication sharedApplication] openURL:request.URL];
return false;
}
return true;
}
But when I want to compile, Xcode tells me :
/Users/adrien/Desktop/iSEN-Lite/Classes/ThirdViewController.m:23: warning: cast from pointer to integer of different size
/Users/adrien/Desktop/iSEN-Lite/Classes/ThirdViewController.m:23: error: expected ';' before ':' token
What am I supposed to do now ?
Isn't the code I found working for this particular case ?
Thanks !