[SOLVED] native.showPopup( "mail", options ) not working on iOS

Anybody knows why iOS is rejecting the below code or have a solution? The popup doesn’t show. In Android it’s working fine.

native.canShowPopup( “mail” ) is indeed returning false

print( native.canShowPopup( "mail" ) ) --prints false

local options = {
    to = "my_email@gmail.com",
    subject = "My Mail Support",
    body = "my body"
local returned = native.showPopup( "mail", options )

print( returned ) --prints false

I am not sure, why it is not working for you, I tired a bare bone project with your code and was getting the popup every time on my iPhone and iPad with iOS 15.4
test.zip (211.5 KB)

I figured it out. The problem was occurring when the mail app is not logged in on the device.
There’s also another way of achieving this goal, using the system.openURL api, with the advantage that if you’re not logged in it shows a popup with the login options, which is the ideal behaviour. At least its what happened in my devices. On the other hand you have escape the characters not permitted in urls.
So a fixed code would be either like this or calling system.openURL directly:

if  native.canShowPopup( "mail" ) then
    local options = {
        to = "mymail@gmail.com",
        subject = "My Subject",
        body = "body"
    native.showPopup( "mail", options )
    local url = "mailto:mymail@gmail.com?subject=My%20Subject&body=body"
    system.openURL( url )