0
在iOS 10之前,我使用了Valentin Sherwin编写的方法here。
任何解决方法,以自定义键盘与Swift 3打开包含应用程序?在Swift 3中打开包含自定义键盘的应用程序?
在iOS 10之前,我使用了Valentin Sherwin编写的方法here。
任何解决方法,以自定义键盘与Swift 3打开包含应用程序?在Swift 3中打开包含自定义键盘的应用程序?
请尝试使用下面的方法。 它在xcode 8.2上运行良好,swift 3.0
func openURL(_ url: URL) {
return
}
func openApp(_ urlstring:String) {
var responder: UIResponder? = self as UIResponder
let selector = #selector(openURL(_:))
while responder != nil {
if responder!.responds(to: selector) && responder != self {
responder!.perform(selector, with: URL(string: urlstring)!)
return
}
responder = responder?.next
}
}
// Usage
//call the method like below
// self.openApp(urlString)
// URL string need to included custom scheme.
// for example, if you created scheme name = customApp
// urlString will be "customApp://?[name]=[value]"
// self.openApp("customApp://?category=1")