Sending an email from swift 3

前端 未结 5 2067
广开言路
广开言路 2020-12-25 09:39

I am trying to set up an app with send email option.

I have this code:

import Foundation
import MessageUI
import UIKit

class emailClass: UIViewContr         


        
5条回答
  •  不知归路
    2020-12-25 10:40

    Code seems to be good and works fine if the app is running in a real device

    MFMailComposeViewController.canSendMail() // returns false for simulators.
    

    You can't test it on simulator,You'll be able to test basic things like UI,How the things are happening on Cancel/Send button clicks.

    To test,You have to use a device,The Mail application in the device should be configured with some mail(ex: abc@xyz.com).

    Hope that helps.

提交回复
热议问题