You’ll find there are a ton of solutions, all of them produce memory related errors because of ARC.
if you want to do it in a way that works, just:
NSString *charactersToEscape = @"!*'();:@&=+$,/?%#" "; NSCharacterSet *allowedCharacters = [[NSCharacterSet characterSetWithCharactersInString:charactersToEscape] invertedSet]; NSString *url = [NSString stringWithFormat:@"%@", @"http://stuff.com/things/"]; NSString *encodedUrl = [url stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters];
Jesus…this took me way too long to figure out