Swift: How to open a new app when UIButton is tapped

后端 未结 5 557
一生所求
一生所求 2020-11-29 10:18

I have an app and when a uibutton is clicked, I want to open another app that is already installed (i.e. Waze). How can I do such? Big thanks.

5条回答
  •  悲哀的现实
    2020-11-29 10:47

    In Swift 4 you can use:

        if let url = URL(string: "\(myUrl)") {
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
        }
    

提交回复
热议问题