Its a shame NSURL can't do this task for us. So here's my stab at it:

You can then use it like so:

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: @"jim", @"username", @"abc123", @"password", nil];

NSString *urlWithQuerystring = [self addQueryStringToUrl:@"" params:params];

Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.

Chris Hulbert

(Comp Sci, Hons - UTS)

iOS Developer (Freelancer / Contractor) in Australia.

I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!

Get in touch:
[email protected]

 Subscribe via RSS