I have one web service but when i pass multiple word like new erra it will return 0 bytes in NSMutuabledata my method is like
NSString *ur开发者_运维问答l = [NSString stringWithFormat:@"%@?url='%@'&word=%@",apiUrl,self.urlString,searchword];
NSMutableData *Data = [appDelegate initRequestWithPost:url withPostData:nil];
where searchword is new era Thanks
I think you have to escape the url string. Try using somthing like this.
+(NSString *)escapeURL:(NSString *)text{
CFStringRef tmp=CFURLCreateStringByAddingPercentEscapes(
NULL,
(CFStringRef)text,
NULL,
(CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",
kCFStringEncodingUTF8 );
NSString * encodedString = (NSString *)tmp;
return encodedString;
}
精彩评论