nam*_*tee -1 ios swift nsurlcomponents
使用URLComponents,有没有办法避免主机的百分比编码?
var components = URLComponents()
components.scheme = "https"
components.host = "endpoint.com/v1/api.php?"
// ends up as https://endpoint.com%2Fv1%2Fapi.php%3F? but I want it to stay as https://endpoint.com/v1/api.php?
Run Code Online (Sandbox Code Playgroud)
这个问题是关于避免编码,而不是添加编码作为作为重复状态链接的问题。
“/v1/api.php”不是 的一部分host,而是path.
用这个:
var components = URLComponents()
components.scheme = "https"
components.host = "endpoint.com"
components.path = "/v1/api.php"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
487 次 |
| 最近记录: |