Peter Lendvay
Peter Lendvay

Reputation: 655

iOS 14 - How to open Default Mail App programmatically?

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.

Upvotes: 17

Views: 6711

Answers (3)

Martin Guillon
Martin Guillon

Reputation: 19

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.

Upvotes: 1

Safdar Ali
Safdar Ali

Reputation: 126

Add following to info.plist

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>https</string>
    <string>http</string>
    <string>mailto</string>
</array>

Upvotes: 8

Peter Lendvay
Peter Lendvay

Reputation: 655

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

Upvotes: 21

Related Questions