r/iOSProgramming • • May 05 '18

Can't send email because email account set up IPhone Simulator

Hello, I am trying to implement the ability to send emails from my app and I believe I have everything setup properly yet it can not recognize a valid email account on the simulator. I have even logged in on my own icloud account on the simulator but still do not have any success. I am not even trying to physically send an email, just make sure my custom email subject and body pop up.

When I use the debugger the following line is False

 MFMailComposeViewController.canSendMail() 

Here is the main block of code that fails and brings up the email not found alert box

    let mailComposeViewController = configureMailComposeViewController()
    if MFMailComposeViewController.canSendMail() {
        self.present(mailComposeViewController, animated:true, completion: nil)
    } else {
        self.showSendMailErrorAlert()
    }

I am getting pretty stumped on this as I have no ideas on how else to enable an email account on the simulator, especially considering there is no way to install the email app on the simulator. Any help is appreciated, thanks.

0 Upvotes

5 comments sorted by

15

u/BadgerBadgerNarwhal May 05 '18

You can't use the mail composer view controller on the simulator. You will need a real device with Mail setup on it.

0

u/[deleted] May 05 '18

[deleted]

21

u/fullm8 May 05 '18

Testing on physical devices doesn’t need the Developer Program subscription anymore. You’re good to go.

3

u/seanpuppy May 06 '18

Ah solid thanks. My apologies for my ignorance.

8

u/[deleted] May 05 '18

You just need a relevant iOS device.

2

u/bctopics May 05 '18

All you need is an iOS device.