mailto: link in UIWebView - Does Not work
In your UIWebView's delegate, do:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if ([[[request URL] scheme] isEqual:@"mailto"]) {
[[UIApplication sharedApplication] openURL:[request URL]];
return NO;
}
return YES;
}
I noticed that when running in the iPhone simulator, I could click on an HTTP link in my UIWebView and it would open in Safari, but when I clicked on a mailto link nothing would happen. But when I deployed the app to a real device, it worked. I expect the reason is because there is no mail app on the simulator, but there is Safari.