import MessageUI
@IBAction func contactButtonAction(_ sender: UIButton) {
showMailComposer()
}
func showMailComposer(){
guard MFMailComposeViewController.canSendMail() else {
self.view.makeToast("연결된 mail이 없습니다 아이폰 기본 mail 어플을 확인해주세요")
return
}
let composer = MFMailComposeViewController()
composer.mailComposeDelegate = self
composer.setToRecipients(["dev.geeyong@gmail.com"])
composer.setSubject("신고 / 문의")
composer.setMessageBody("", isHTML: false)
present(composer, animated: true)
}
extension PersonalInfoViewController: MFMailComposeViewControllerDelegate{
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
if let _ = error {
controller.dismiss(animated: true)
}
controller.dismiss(animated: true)
}
}
'개발 > 아이오에스' 카테고리의 다른 글
xcode 에러 “The Local repository is out of date”…i have no branch how to solve this (0) | 2021.02.23 |
---|---|
ios] Alamofire / kakao api 활용 http 통신하기 (0) | 2021.02.02 |
swift IOS] 네비게이션 컨트롤러 뒤로가기 버튼 텍스트 변경하기 (0) | 2021.01.18 |
ios swift] 이전 뷰로 이동하기 (코드) (0) | 2021.01.18 |
ios] xcode app 다크모드 적용 끄기 (0) | 2021.01.13 |