我有WCF服务,我想从我的Web服务获取数据。但URL总是返回零。为什么?我想将参数发送到来自文本字段值的WCF。例如;NSURL总是返回零
txtfield.text = @"ATAŞEHİR";
怎么了?
NSString *request = [NSString stringWithFormat:@"http://www.xxxxxxxx.com/CCWCF.svc/MethodName/%@",txtfield.text];
NSURL *URL = [NSURL URLWithString:[request stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
我尝试过不同的事情,但结果没有改变。
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.xxxxxxxx.com/CCWCF.svc/MethodName/%@",txtfield.text]];
或:
NSURL *URL = [[NSURL alloc] initWithString:[request stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
你尝试'NSUTF8StringEncoding'代替(你的字符串似乎是Unicode)? – Alladinian 2013-03-08 09:59:19
@ Rajneesh071请不要使用'replaceOccuranceOfString ...'做这个。百分号转义例程*远*更有能力 – 2013-04-09 13:21:22
ohk好友谢谢... – Rajneesh071 2013-04-09 14:11:15