How to take the parameter from URL scheme.

前端 未结 3 1160
死守一世寂寞
死守一世寂寞 2021-02-06 17:49

I am using URL scheme in my iPhone app,from a page I switch user to safari,and a button click from Web page,I am reverting back to app At that time ,some parameters are passed b

3条回答
  •  感动是毒
    2021-02-06 18:20

    NSString *query = [url query];
    NSArray *queryComponents = [query componentsSeparatedByString:@"&"];
    

    Now you got all strings in queryComponents like

    param1=value
    

    Now you can get first value like that

    NSArray *firstParam = [[queryComponents objectAtIndex:0] componentsSeparatedByString:@"="];
    
    [firstParam objectAtIndex:0] is the name of param
    [firstParam objectAtIndex:1] is value of the param
    

提交回复
热议问题