Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get email link to work #2

Open
stefandesu opened this issue Dec 13, 2017 · 3 comments
Open

Can't get email link to work #2

stefandesu opened this issue Dec 13, 2017 · 3 comments

Comments

@stefandesu
Copy link

Hi,

First of all, thanks for keeping MarkdownKit alive with this project. I'm almost finished making my first app and I'm using Haring for the About section.

Unfortunately, I haven't been able to get email links to work. Neither [Mail]([email protected]) nor [Mail](mailto:[email protected]) nor [Mail](message://[email protected]) are working. Just writing the email address still converts it to a link, but tapping it still doesn't do anything. A long press opens the Open/Copy/Share menu, but even then "Open" doesn't do anything.

Am I doing something wrong or is this a bug?

Thanks!

@DavidLari
Copy link
Owner

I just modified the example and used Email [User at example dot com](mailto:[email protected]) and it seems to work. Using Xcode 9.2, iOS 11 SDK, running on iOS 11.2 physical device and it works in my testing. Are you using a device or the simulator?

@stefandesu
Copy link
Author

Found the mistake! What I actually did was [[email protected]](mailto:[email protected]) which apparently doesn't work. To get down to the issue, I added the textview delegate like in your examples, and found out that the URL it tries to open is not "mailto:[email protected]" but rather "[email protected]" which does not work. I discovered by accident that it actually takes the content of the square brackets as the URL. I think it might be the automatic detection working against the manual link syntax. In fact, when I disable automatic link detection, [[email protected]](mailto:[email protected]) works properly.

I also found out that if I implement the delegate like in your example, i.e. using UIApplication.shared.open AND return true, it opens the mailto link both in Mail.app and in a new email window inside the app. To fix it, I changed it to return false. Do you think this might have any disadvantages?

Thanks for helping me with the issue. We might have discovered a small bug as well.

@DavidLari
Copy link
Owner

I will take a look and see if I can understand better what the code is doing. Since I didn't write this I'm not very familiar with how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants