My iPhone app needs to do some URL escape sequence encoding for a form parameter. The NSString stringByAddingPercentEscapesUsingEncoding as stringByAddingPercentEscapesUsingEncoding doesn't escape a lot. This is what I have
-(NSString*)currentMessageUrlEncoded{
CFStringRef originalURLString = (CFStringRef) self.currentMessage;
CFStringRef urlString = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, originalURLString, NULL, (CFStringRef) @"&+", kCFStringEncodingUTF8);
NSString *result = (NSString*) urlString;
[result autorelease]; // Is this sufficient?
return result;
}
I'm not sure about the memory management here? Is the autorelease on the result sufficient, or am I barking up the wrong tree altogether?