在我的应用程序中,我将一个字符串传递给service,它将一些数据设置为远程数据库。一切都很完美,只要我没有“&”在我的字符串中。
我用它来传递参数:
NSString *urlString = [[NSString
stringWithFormat:@"http://someservice.com/some/some_setstatus.php?status=active&name=%@",
merchant] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
我的猜测是,当它使用保存在数据库中的名称检查名称时,由于'&'而无法找到名称。
答案 0 :(得分:0)
答案 1 :(得分:0)
您需要为网址转义&
字符(更多信息:http://www.ietf.org/rfc/rfc3986.txt)
看看https://github.com/tagyro/GTM/blob/master/Foundation/GTMNSString%2BURLArguments.h
这是来自SVN的Google Toolbox for Mac的克隆版。
答案 2 :(得分:-1)