탭했을 때 UIAlertView를 표시하는 앱에 UIButton이 있습니다. 알림보기에는 iOS 이메일 작성보기를 여는 버튼이 있습니다.'UIAlertControllerStyle.Type'유형의 값을 예상되는 인수 유형 'UIAlertControllerStyle'로 변환 할 수 없습니다.
메일 작성보기가 훌륭하게 작동하지만 사용자가 이메일을 보내거나 "취소"를 누르면 메일 작성보기가 사라지지 않습니다. 나는이 오류가 이대로가 보이지 않는다 사용하고 코드는 작동합니다 :
유형의 값 예상 인수 유형 'UIAlertControllerStyle.Type을'변환 할 수 없습니다 'UIAlertControllerStyle'
var alert = UIAlertController(title: "Alert", message: "Your Device cannot send emails", preferredStyle: UIAlertControllerStyle)
수 있습니다 무엇 여기서? 감사!
var myMail: MFMailComposeViewController!
@IBAction func helpfeedbackAlert(_ sender: Any) {
if(MFMailComposeViewController.canSendMail()){
myMail = MFMailComposeViewController()
myMail.setSubject("Test")
myMail.setToRecipients(["[email protected]"])
self.present(myMail, animated: true, completion: nil)
}
else{
var alert = UIAlertController(title: "Alert", message: "Your Device cannot send emails", preferredStyle: UIAlertControllerStyle)
self.present(alert, animated: true, completion: nil)
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
func mailComposeController(controller: MFMailComposeViewController!, didFinishWith: MFMailComposeResult, error: NSError!){
switch result.rawValue {
case MFMailComposeResult.cancelled.rawValue:
print("Mail cancelled")
case MFMailComposeResult.sent.rawValue:
print("Your email has been sent!")
case MFMailComposeResult.failed.rawValue:
print("Email has failed to send: %@", [error!.localizedDescription])
default:
break
}
// Dismiss the mail compose view controller
controller.dismiss(animated: true, completion: nil)
}
하나의 문제가 단지 관련 코드에 질문을 좁힐하십시오. 완전히 다른 두 가지 문제와 관련성이없는 코드가 너무 많습니다. – rmaddy
@rmaddy 물론, 게시물을 편집했습니다. – Miles