Can't send E-Mail from container in build app

I have a button on an container that should send an e-mail. This works in the iOS simulator, but not in the builded application. In the builded application it works only, when the button is placed direkt in the view.
An example can be loaded here

Maybe you could place the SMTPSocket and the send mail methods on the view, and have the button action only call them ?

I have tested this:
Methode in View
Public Sub SendMail()
mailComposeView = new Extensions.MFMailComposeViewController
mailComposeView.setToRecipients Array(“apps@appsforme.de”)
mailComposeView.setSubject “Dating Manager”
dim MyMSG as Text
MyMSG = “Hello,” + EndOfLine + EndOfLine +_
“This is an Email form iOS” + EndOfLine + EndOfLine
mailComposeView.setMessage MyMSG

if Extensions.MFMailComposeViewController.canSendMail then
mailComposeView.PresentInView(self)
end if
End Sub

And on the button in container:
Sub Action() Handles Action
dim cc as new ViewSendMail
cc.SendMail
End Sub

But I also works in the simulator, but not in the builded application on my iPhone.

Where is the socket ?

What socket? I use Extensions.MFMailComposeViewController from iOSKit.

You may try with making cc a property of the view so it has a longer life.

When I call the method with “call ViewSendMail.SendMail” , I got this error:

Static reference to instance method: call this on an instance of a class ViewSendMail.ViewSendMail.

Add a reference to the view as a property of the container. For instance myView as ViewSendMail which you initialize when you instantiate the container dynamically, or in the view Open if you dragged it onto the view.

Then do

call myView.SendMail

you may need to wait some amount of time for it to actually send
a call to “send mail” is unlikely to be instantaneous
we see this issue on desktop apps as well with the classic framework
cant say how or if the ioskit functions have a mechanism to let you know that it has sent successfully

Silly question but is canSendMail returning true? It might not be if your have no email setup which would explain why it’s not showing up. Also you need to keep a reference to the container as Michel suggests as well as the mail compose view controller itself. There class does not currently forward to you if the sending succeeded or not, but it could if you wanted to get those values.

Okay. Added a property “MyView” as reference to ViewSendMail and changed the send mail definition:

	mailComposeView = new Extensions.MFMailComposeViewController
	mailComposeView.setToRecipients Array("apps@appsforme.de")
	mailComposeView.setSubject "Dating Manager"
	dim MyMSG as Text
	MyMSG = "Hello, This is an Email form iOS" 
	mailComposeView.setMessage MyMSG
	
	if Extensions.MFMailComposeViewController.canSendMail then
			mailComposeView.PresentInView(MyView)
	else
			MsgBox "Error while sending E-Mail"
	end if

The same result. In the build application the button does nothing. Only the button with the same feature in the main view works.

So I think the problem is you are not pushing to the view. You create it, but you must also push to it or show it (embed it for a container control) in order to be able to use the mail compose view controller. Try to change your code so you are also pushing to the view instead of just creating it, which won’t be enough.