Before iOS 10 i used the method written by Valentin Sherwin here.
Any workarounds to open the containing app from the custom keyboard with Swift 3?
Asked
Active
Viewed 676 times
0

Community
- 1
- 1

DanielZanchi
- 2,708
- 1
- 25
- 37
1 Answers
1
please try to use below method. it worked well on 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")

Torun Nesse
- 31
- 1