且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASIHttpRequest-如何将参数的NSDictionary转换为url编码的查询参数字符串?

更新时间:2023-02-24 09:47:33

您必须将查询字符串作为URL的一部分传递.从 GitHub 上的ASIHTTPRequest界面中:

You must pass the query string as part of the URL. From the ASIHTTPRequest interface on GitHub:

// The url for this operation, should include GET params in the query string where appropriate
NSURL *url; 

如果您不想使用自己的字典到查询字符串的方法,请查看Mac版Google工具箱中的GTMNSDictionary+URLArguments类别(.m ).它向NSDictionary添加了一种方法gtm_httpArgumentString,应该是您要遵循的方法.

If you don't want to roll your own dictionary-to-query-string method, take a look at the GTMNSDictionary+URLArguments category in Google Toolbox for Mac (.h, .m). It adds a method, gtm_httpArgumentString, to NSDictionary that should be what you're after.