special character return nil in nsurl
I have an nsstring like this
http://example.com/webservices/test?method=eventlist&title=Prog%
i want to change this nsstring to nsurl, but it returns nil in nsurl.I know it return nil because of percentage at the end, but i want to add percentage with every title to get an value.. So i dont know开发者_StackOverflow中文版 how to do this ?
Can anyone help me?
Thanks in advance............
You need to encode the special characters into URL codes :
NSString *encodedURLString = [urlString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSURL *URL = [NSURL URLWithString:encodedURLString];
精彩评论