Having problem in native.showPopup( "mail", options ) for ios 9.1

Good day everyone, I have little problem in native.showPopup( “mail”, options ). It shows at first (slides up) then in a few seconds it hides (slides down). My version of corona is v2015.2756. I use this version because my ios sdk is 9.1

even in this simple code, the problem still exist. Is this a bug?

main.lua

[lua]

local options =

{

  to = {“rylaya@binaryideas.com”},

  subject = “Contact form shohreh | From game app”,

  body = “(edit)”,

}

native.showPopup( “mail”, options )

[/lua]

in my config.lua

[lua]

application =

{

content =

{

width = 320,

height = 480, 

scale = “zoomEven”,

fps = 30,

–[[

imageSuffix =

{

   ["@2x"] = 2,

},

–]]

},

}

[/lua]

Thank you.

Hi Raymund,

You can try the example I mentioned, just without the file part. I just want to check if that works for you…

Brent

Hello @Brent

I tried your suggestion but the problem still exist. I also tried creating dummy “Screenshot.png” for testing only unfortunately it’s still the same, It shows (slide up) then in a few seconds it hides (slides down).

Here’s my code in main.lua

[lua]

local options =

{

  to = “rylaya@binaryideas.com”,

  subject = “From game app”,

  body = “sample body”,

  attachment = { baseDir=system.DocumentsDirectory, filename=“Screenshot.png”, type=“image/png” },

}

native.showPopup( “mail”, options )

[/lua]

Thank you,

Raymund

I just built this code and ran it on my iPhone 6:

local options = { to = "rylaya@binaryideas.com", subject = "From game app", body = "sample body", attachment = { baseDir=system.ResourceDirectory, filename="selfie-stick.jpg", type="image/jpg" }, } native.showPopup( "mail", options )

Now the only thing I did different was pulled the file from the app bundle. I also made a version where I copied the image to system.DocumentsDirectory and that worked too.

Are you sure “Screenshot.png” exists in your system.DocumentsDirectory? Are you sure the first letter is an upper case “S”? are you usre you’re screen shot is not a JPEG instead of a PNG?

Rob

Hello @Rob
 
I just created new project with the exact sample code  from the documentation. It’s still the same  :frowning: .
 
[lua] 
local options =
{
   to = “john.doe@somewhere.com”,
   subject = “My High Score”,
   body = “I scored over 9000!!! Can you do better?”,
   attachment = { baseDir=system.DocumentsDirectory, filename=“Screenshot.png”, type=“image/png” },
}
native.showPopup( “mail”, options )
[/lua]
 
and also here’s the SS of the files, project name “emailsample”.

2eewhzc.png

Tested it in iphone 5  iOS 9.1 simulator, here’s the video of the error.

emailerror

my last resort is to use system.openURL( “mailto:nobody@mycompany.com” )  :( 

The files you show in your screen is in your App’s bundle or your system.ResourceDirectory, not system.DocumentsDirectory.  The system.ResourceDirectory is a read-only part of your app. You cannot save screen shots there. Screen shots should be saved either to system.DocumentsDirectory or system.TemporaryDirectory.

If you change your call to system.ResourceDirectory, it will work for that one image but you want to use screen shots with your post, so you’re going to have to figure out where you’re saving your screen capture to, what you’re naming it and make sure what file type it is (JPEG or PNG) and construct a valid path to your real image.

Rob

Hi @Rob

This is really strange I tried it in real device and it works, I don’t know why in simulator it didn’t. Well, thank you for helping me, I’m new to corona and I’m really grateful that you guys are very active  :slight_smile:

This popup does not work in the simulator. You  have to test on device.

Rob

Hi Raymund,

You can try the example I mentioned, just without the file part. I just want to check if that works for you…

Brent

Hello @Brent

I tried your suggestion but the problem still exist. I also tried creating dummy “Screenshot.png” for testing only unfortunately it’s still the same, It shows (slide up) then in a few seconds it hides (slides down).

Here’s my code in main.lua

[lua]

local options =

{

  to = “rylaya@binaryideas.com”,

  subject = “From game app”,

  body = “sample body”,

  attachment = { baseDir=system.DocumentsDirectory, filename=“Screenshot.png”, type=“image/png” },

}

native.showPopup( “mail”, options )

[/lua]

Thank you,

Raymund

I just built this code and ran it on my iPhone 6:

local options = { to = "rylaya@binaryideas.com", subject = "From game app", body = "sample body", attachment = { baseDir=system.ResourceDirectory, filename="selfie-stick.jpg", type="image/jpg" }, } native.showPopup( "mail", options )

Now the only thing I did different was pulled the file from the app bundle. I also made a version where I copied the image to system.DocumentsDirectory and that worked too.

Are you sure “Screenshot.png” exists in your system.DocumentsDirectory? Are you sure the first letter is an upper case “S”? are you usre you’re screen shot is not a JPEG instead of a PNG?

Rob

Hello @Rob
 
I just created new project with the exact sample code  from the documentation. It’s still the same  :frowning: .
 
[lua] 
local options =
{
   to = “john.doe@somewhere.com”,
   subject = “My High Score”,
   body = “I scored over 9000!!! Can you do better?”,
   attachment = { baseDir=system.DocumentsDirectory, filename=“Screenshot.png”, type=“image/png” },
}
native.showPopup( “mail”, options )
[/lua]
 
and also here’s the SS of the files, project name “emailsample”.

2eewhzc.png

Tested it in iphone 5  iOS 9.1 simulator, here’s the video of the error.

emailerror

my last resort is to use system.openURL( “mailto:nobody@mycompany.com” )  :( 

The files you show in your screen is in your App’s bundle or your system.ResourceDirectory, not system.DocumentsDirectory.  The system.ResourceDirectory is a read-only part of your app. You cannot save screen shots there. Screen shots should be saved either to system.DocumentsDirectory or system.TemporaryDirectory.

If you change your call to system.ResourceDirectory, it will work for that one image but you want to use screen shots with your post, so you’re going to have to figure out where you’re saving your screen capture to, what you’re naming it and make sure what file type it is (JPEG or PNG) and construct a valid path to your real image.

Rob

Hi @Rob

This is really strange I tried it in real device and it works, I don’t know why in simulator it didn’t. Well, thank you for helping me, I’m new to corona and I’m really grateful that you guys are very active  :slight_smile:

This popup does not work in the simulator. You  have to test on device.

Rob