native.showPopup("mail", options) - Not working with Solar2D ?

In my app I have the following code (so the users can send an error og back to me):

local options =
{
to = “allthumbsdev@gmail.com”,
subject = “Karate Squid Log”,
body = “Your comment here”,
attachment = { baseDir=system.DocumentsDirectory, filename=LOG_ZIP_FILE, type=“log/zip” }
}

native.showPopup( “mail”, options )

This has worked great, but after I switched to Solar 2D (which is just now), this doesn´t seem to work anymore. Not in the simulator (Mac) or with an actual device (iPhone). There are no error messages or anything. The code is just ignored.

Has anything changed in this department? The docs are the same, as far as I can tell.

I use it just fine (albeit without an attachment) on Android and iOS.

It isn’t working for me either. As @runewinse said, the call is completely ignored both in simulator and on the iPhone. I am using Corona Simulator 2020.3624

Does anyone know what the problem may be?

I just realised that the file that was supposed to be attached was missing. That’s why the call was ignored (also making the app freeze for a few seconds). If the file is found the mail popup shows as expected.

Maybe that is my problem also. I have to doublecheck that the file indeed exists. Thanks for the suggestion!

I really don´t get this. I made a test if the file exists and it fails already in the pathForFile() function, but the file/path seems to be valid (see the log.zip info dialogue).

In your console there is a “log.zip removed” output. Is the file maybe removed at runtime before you call u.fileExist?

Also, if u.fileExist returns false you print “File does exist”. Shouldn’t this print “File does not exist?”. It’s confusing.

Sorry about the “File does exist”. It was a typo. Should ofcourse have been “File does NOT exist!”

As for the “log.zip removed” console output, this is from the removal of the old log.zip file.

Here is a modified version. This time Ive listed all the files in the DocumentsDirectory folder right before checking the existence of the log.zip file and surely enough, it´s right there in the list of files.

I´m very confused by now…

What does the u.fileExist function do? Are you sure it does what it’s supposed to? Does fileExist work ok for the other files in the directory, e.g. log.txt?

Also, in the showPopup options the type should be “application/zip” and not “log/zip”. You can find here a list of the most common MIME types: https://en.wikipedia.org/wiki/Media_type

Thanks, I found a couple of lines of dubious code…

I used the fileExist() function in a wrong way, since the second parameter defaulted to the ResourceDirectory if nil. I´ve now used it correctly and it reports the file as existing.

But that I already knew, both from checking it in Finder and from the log from the folder listing done right before. The log shows like this:

Thanks for the heads up about the “application/zip”. It has worked before with my old parameters, but that could have been blind luck.

And this is the code for the file/folder checking and the call to showPopup, hopefully with the correct parameters. It still does not work though…

delete_me.lua (1.1 KB)

Here is a complete example that shows the non-functioning showPopup(). Hopefully it´s just something stupid that I´ve done… :slight_smile:

example.zip (1.7 KB)

I run your example project, replacing the LOG_ZIP_FILE with “log.zip” as follows:
attachment = { baseDir=system.DocumentsDirectory, filename="log.zip", type="application/zip" }

The native.showPopup worked fine on the iPhone attaching the log.zip file. On simulator it doesn’t work but I don’t think it’s supposed to work on the simulator anyway.

Ok, thanks for all your help! No need for me to waste any more time trying to get this to work in the simulator then :slight_smile:

I still do not get any response though… Maybe it is something wrong with the setup of this one iPhone for all I know. I´ll try with some other iPhone.

hi, I’m having the same issue as the OP. I had a link in my app that users could tap to email me. Worked fine for years. I am tinkering with the app for the first time in over a year, and noticed that the email link no longer works on my iPad. I have the device connected to my computer so I can watch the console. The call to native.showPopup(mail) returns false on the device. I’m running simulator build 2020.3635 on MacOS 11.1. My iPad is using iPadOS 14.2. Here’s the code in question:

local options =
{
to = { “david@vancouvermusictheory.com” },
subject = “From a Mini Music Theory School user”
}

native.showPopup(“mail”, options)

I used the fileExist() function in a wrong way, since the second parameter defaulted to the ResourceDirectory if nil. I´ve now used it correctly and it reports the file as existing.