我正在用Swift 4.2编写iOS应用。我正在使用Moya Networking。
我必须使用下面的GET查询从服务器获取数据:
> 1555515000
AND quitID ='9FE17AA3-E182-6DFA-FF1D-52B33B2B8D00'并且
ownerId ='AC1CB90D-CF3E-7243-FF87-9E408D68E800'&props = sleepHours,添加日期,添加日期
我的代码:
var task: Task {
switch self{
case .getTrends(let quiltID, let addedDate, let ownerId):
return .requestParameters(parameters: ["where":"addedDate > \(addedDate) AND quitID='\(quiltID)' AND ownerId ='\(ownerId)'", "props":"sleepHours,addedDay,addedDate"], encoding: URLEncoding.default)
}
}
但是发出它,在执行它时会出现以下GET查询:
https://api.backendless.com/AABE5C4B-AA58-955C-FF16-27B64A185300/46FDFF59-CF95-B699-FFF5-83B681610700/data/quilt_detail?where=addedDate
代替:
addDate> 1555515000 AND
quitID ='9FE17AA3-E182-6DFA-FF1D-52B33B2B8D00'并且
ownerId ='AC1CB90D-CF3E-7243-FF87-9E408D68E800'
它的制作:
addDate%20%3E%201556955782%20AND%20quitID%3D%276264A540-84F3-4D09-FF8D-00D4C94E9D00%27%20AND%20ownerId%20%3D%27DB64B524-8524-8973-9357-FF67-3C69B6CD1C00%27
如何使用空格进行GET查询?
最佳答案
URL字符串从不包含空格Check Here
关于ios - 使用空格进行GET查询,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56088302/