【发布时间】:2018-01-30 02:20:24
【问题描述】:
我正在尝试创建一个类似的 URL https://api.website.com/products?product_ids=1,2,3,4,5 使用 CoreData 中的整数数组
到目前为止我确实有这个代码
let array = [1,2,3,4,5]
var urlComponents = URLComponents()
urlComponents.scheme = "https"
urlComponents.host = "api.website.com"
urlComponents.path = "/products"
urlComponents.queryItems = [
URLQueryItem(name: "product_ids", value: ???????),
]
如何添加数组数据以获得所需的完整 URL? https://api.website.com/products?product_ids=1,2,3,4,5
【问题讨论】: