Through the online search, reference to other people's knowledge, (not to steal know, I myself did) I know I have a lot of shortcomings, I hope one day can stand in the pyramid point
The URL is:
woaiwodejiaxiang://cn.jiaxiang.zg/loader?dt=1254896584562&cityid=tr&devicenumber=13185058252& Userid=20985532&roletype=2&state=1&token=dad8fa595beda8306ea1aa01250aeb0&deviceimei= 3951545154614522
1.
NSString *urlstring = [nsstring stringwithformat:@ "%@", url];//convert URL to nsstring
Nsmutablearray *urlarray =[nsmutablearray arraywithobject: urlstring];//and placed in array
Nsrange range = [urlarray[0] rangeofstring:@ "?" ]; Get the question mark position after the question mark is the parameter list urlarray[0]: I have only one element in the array
NSString *propertys = [urlarray[0] substringfromindex:(int) range. Location]; Parameter list
Nsarray *subarray =[propertys componentsseparatedbystring:@ "&"];//Split the string, split by &,
2.
Nsmutabledictionary *tempdic = [nsmutabledictionary dictionarywithcapacity:8];/ /8 is my URL has 8 parameters the most always get the dictionary has 8 key value pairs
For (int j = 0; j<subarray. Count; j + +) {
nsarray *dicarray = [Subarray[j] componentsseparatedbystring:@ "="];//equal sign "=" is used to split the key value pair
[Tempdic setobject:d icarray[1] forkey:d icarray[0]];//Add a key-value pair to the dictionary (I refer to someone else's)
}
NSLog(@ " print parameter list generated dictionary:\n%@", tempdic);//Dictionary of output conversions
{
"? dt" = 1254896584562;
Cityid = Gy;
Deviceimei = 3951545154614522;
DeviceNumber = 13185058252;
Roletype = 1;
state = 1;
token = dad8fa595beda8306ea1aa01250aeb0;
UserId = 20985532;
}
URL converted to Dictionary dictionary