iOS 14 - How to open Default Mail App programmatically?
Asked Answered
T

3

16

With iOS14 users can set different email client apps as their default.

Is there a way to open the selected default mail app programmatically?

Using mailto: URLs, after setting the default mail app to Gmail, don't do anything.

Theisen answered 20/10, 2020 at 14:37 Comment(0)
T
20

Apparently you have to add mailto to the LSApplicationQueriesSchemes to make it work.

Theisen answered 20/10, 2020 at 14:49 Comment(1)
the issue with this solution is that it will open the compose new mail in the clients.. do you know another way that open just the default without any action @peter-lendvayTuba
C
7

Add following to info.plist

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>https</string>
    <string>http</string>
    <string>mailto</string>
</array>
Castellano answered 9/1, 2022 at 13:35 Comment(2)
http and https do not need to be in that listSirrah
I didn't know how to edit the info.plist file directly, so here is how it looks like in Xcode 14 in Info -> Custom iOS Target Properties.Achromatism
E
1

I just saw this in the doc url_launcher package, that's why it didn't work for me:

URL schemes are only supported if there are apps installed on the device that can support them. For example, iOS simulators don't have a default email or phone apps installed, so can't open tel: or mailto: links.

Ernestinaernestine answered 28/10, 2023 at 12:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.