I want to add 2 parameters to NSURLRequest.
Is there a way or should I use AFnetworking?
NSDictionary *params = @{@"firstname": @"John", @"lastname": @"Doe"};
NSMutableString *str = [NSMutableString stringWithString:@"http://yoururl.com/postname?"];
NSArray *keys = [params allKeys];
NSInteger counter = 0;
for (NSString *key in keys) {
[str appendString:key];
[str appendString:@"="];
[str appendString:params[key]];
if (++counter < keys.count) { // more params to come...
[str appendString:@"&"];
}
}
NSURL *url = [NSURL URLWithString:str];
// should give you: http://yoururl.com/postname?firstname=John&lastname=Doe
// not tested, though