How can I add GET parameters to an ASIHttpRequest?
I want to go from http://mysite.com/server to http://mysite.com/server?a=1&b=2 programmatically.
I have all my parameters as key-value pairs in an NSDictionary object.
Thanks
How can I add GET parameters to an ASIHttpRequest?
I want to go from http://mysite.com/server to http://mysite.com/server?a=1&b=2 programmatically.
I have all my parameters as key-value pairs in an NSDictionary object.
Thanks
Use string format like
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@"1",@"a",@"2",@"b", nil]; NSMutableString *prams = [[NSMutableString alloc] init]; for (id keys in dict) { [prams appendFormat:@"%@=%@&",keys,[dict objectForKey:keys]]; } NSString *removeLastChar = [prams substringWithRange:NSMakeRange(0, [prams length]-1)]; NSString *urlString = [NSString stringWithFormat:@"http://mysite.com/server?%@",removeLastChar]; NSLog(@"urlString %@",urlString);