1

I have an email address in a UITextView (detected with UIDataDetectorTypes) that opens a mail composer in-app (like a MFMailComposeViewController) rather than opening the default Mail app itself.

self.textView.dataDetectorTypes = UIDataDetectorTypeLink;
// ...
self.textView.text = @"Blah blah email@address.com blah blah";

I was under the impression that email addresses and other links would, by default, open in an external app rather than the app itself. Is there a setting that determines this? The problem with this is that the mail composer doesn't fit with the app's layout and the send and cancel buttons are hidden (in iOS 7), but either way I'd prefer to have mail app open instead.

This is happening on iOS 6 and 7, both on devices on in the simulator. On an iOS 5 device it works as I expected (the mail app is opened).

newenglander
  • 2,019
  • 24
  • 55

2 Answers2

3

Running some tests of my own, it seems we have no control over how the detected values are handled. You can't create custom detectors either, but you can fake it: https://stackoverflow.com/a/2433763/143225

For reference(though not an answer to your question), you can open the Mail app like so:

[UIApplication sharedApplication] openUrl:[NSURL URLWithString:@"mailto:email@address.com"]

Mail URL Scheme: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MailLinks/MailLinks.html#//apple_ref/doc/uid/TP40007899-CH4-SW1

Opening URLs: https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplication_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006728-CH3-SW14

Much mail, very sendy.

Community
  • 1
  • 1
Brenden
  • 7,708
  • 11
  • 61
  • 75
0

Maybe this post will help you:

It allows to start a custom email view when you click on a text view mail adress

https://stackoverflow.com/a/31167489/3593801

It works for me.

Community
  • 1
  • 1
VictorPurMar
  • 151
  • 9