For example, I got something format like this:
link://thisIsAction?param1=value1¶m2=value2
and it may have one param like this
link://thisIsAction?param1=value1
or don’t have any param:
link://thisIsAction
How can I extract the thisIsAction, and the param, and value?
The param may not start with the prefix param, it may just simple as p.
And I want the param and value return in a dict… How can I do so? Thanks.
Convert the string to a NSURL and then use the API to extract different parts of it, including the query string parameters.
You can get the host using
Documentation on it here
As pointed out by @Rene, to get the query value in a dictionary, follow the top answer on Parse NSURL query parameter