我有这种情况,我需要使用包含“.
例如:
NSString *myStringWithURL = [NSString stringWithFormat:
@"http://myurl.com/setParam.php?setName=
{\"name\":\"%@\"} ", name];
// myStringWithURL will return the desired URL but it is a String.
// of course I need it as URL in order to make the request.
NSURL *targetURL = [NSURL URLWithString : myStringWithURL];
//This will return nil.
所以问题是如何让我的 URL 不返回 nil?
{"name":"My Name"} 部分应该是 JSON,但这似乎比使用 NSDictionary 然后使用 JSON 解析器等更简单。
我非常感谢你的帮助!!