Reputation: 21
I want to go inside of the app for particular Controller by using of Deeplinking.
I write the following code in my AppDelegate file but it don't call that method, even also but it go to every time home page only.
extension AppDelegate{
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
print("url \(url)")
print("url host :\(url.host!)")
print("url path :\(url.path)")
let urlPath : String = url.path as String
let urlHost : String = url.host as! String
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
//PickuppageControllerDeeplinking://host/inner
if(urlHost != "mail.google.com")
{
print("Host is not correct")
return false
}
if(urlPath == "/inner"){
let innerPage: PickupsPageController = mainStoryboard.instantiateViewController(withIdentifier: "PickupsPageController") as! PickupsPageController
self.window?.rootViewController = innerPage
} else if (urlPath == "/about"){
}
self.window?.makeKeyAndVisible()
return true
}
}
Upvotes: 2
Views: 958
Reputation: 144
You need to implement URL Schemes for this. Refer this link for documentation
You need to do two things
application(_ application: UIApplication,
open url: URL,
options: [UIApplicationOpenURLOptionsKey : Any] = [:] ) -> Bool
Upvotes: 1