button / DeepLinkKit

A splendid route-matching, block-based way to handle your deep links.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Route parameters are null

riyazarnr opened this issue · comments

while creating a DPLMutableDeepLink it's route parameters are null.

That's expected. Route parameters are whatever you defined in a route and are not relevant in a mutable deep link unless you made a mutable copy of an incoming DPLDeepLink instance:

E.g.

router[@"some/:route_param"] = ^(DPLDeepLink *link) {
    // link[@"route_param"] or link.routeParameters[@"route_param"] will have the value of that path item
    // If an incoming url was "myapp:///some/thing" the value of link[@"route_param"] would be "thing"
}

Are you looking for the queryParameters? How are you creating your DPLMutableDeepLink?

let dplink = DPLMutableDeepLink(string: "https://eg.co/\(identifier)")
        deeplinkRouter.registerBlock({ (dplink) in
           let idetifier =  link.routeParameters["identifier_id"] as! String)
            }, forRoute:"/:identifier_id"

This is what i'm using to generate MutableLink, Please review and revert back.

let dplink = DPLMutableDeepLink(string: "https://eg.co/\(identifier)")
        deeplinkRouter.registerBlock({ (dplink) in
           let str = dplink.routeParameters["id"] as! String
            }, forRoute:"/:id")

I'm not sure what you're doing with the DPLMutableDeepLink here.

Also, you have a shadowed variable

  • you define dplink as aDPLMutableDeepLink, then
  • you define the route handler variable as dplink which is of type DPLDeepLink

Can you explain what it is you're trying to achieve here? I'm not following.