How can I build a URL with query parameters containing multiple values for the same key in Swift?

后端 未结 7 1146
一生所求
一生所求 2020-12-08 18:35

I am using AFNetworking in my iOS app and for all the GET requests it makes, I build the url from a base URL and than add parameters using NSDictionary Key-Value pairs.

7条回答
  •  佛祖请我去吃肉
    2020-12-08 19:34

    I guess u just have to do something like this:

    let params = ["id" : [1, 2, 3, 4], ...];
    

    which will be encoded into: ....id%5B%5D=1&id%5B%5D=2&id%5B%5D=3&id%5B%5D=4....

提交回复
热议问题