How can I launch an email client on ios using Swfit

前端 未结 4 615
误落风尘
误落风尘 2021-01-02 06:04

In Android, I can launch an email client from my android application using its Intent mechanism. In ios, how can I launch its email client from my ios application using Swif

4条回答
  •  借酒劲吻你
    2021-01-02 06:26

    Update iOS 10+

    //Use for Open mail application or open any link with browser!

    let url = NSURL(string: "mailto:your_mail_here@mail.com")
    
    if #available(iOS 10.0, *) {
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    } else {
       // Fallback on earlier versions
       UIApplication.shared.openURL(url)
    }
    

提交回复
热议问题