How-To: URL Encode NSString in Objective-C
Jan.21, 2009 in
Tech
It’s very easy to URL Encode an NSString in Objective-C (i.e. make a string safe to send using a GET request). Simply do this:
NSString* escapedUrlString =
[unescapedString stringByAddingPercentEscapesUsingEncoding:
NSASCIIStringEncoding];
Then just use the escapedUrlString in your NSURL object and you’re on your way.

Leave a Reply