简体   繁体   中英

Make HTTP Get request in iOS with params

I want to make an HTTP GET request from my iOS client and place in the request params. I have written code that performs a POST request, where it was very easy to use setHTTPBody to place a NSData* object in the request. How is this done for a GET request?

Thanks

In a GET method the parameters are passed in the query string - so you suffix your URL with something like ?param1=value1&param2=value2&param3=value3. You may need to percent-encode your query string if it contains characters like space, & or =

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM