티스토리 뷰

후 내 4시간 돌려줘요...

 

"

Because the ? isn't part of a path. It's a separator to signal the beginning of the query string. You can read about the different components of a URL in this article. Each component has its set of valid characters, anything not in that set needs to be percent-escaped. The best option is to use URLComponentswhich handles the escaping automatically for you:

"

 

var urlComponents = URLComponents(string: MyRouter.baseURLString)!

urlComponents.queryItems = [ URLQueryItem(name: "username", value: "jsmith"), URLQueryItem(name: "password", value: "password") ]

let url = urlComponents.url!

 

'macOS, iOS' 카테고리의 다른 글

RxSwift subject/driver/behaviorRelay  (0) 2019.12.14
인코딩이 깨져서 나올 때  (0) 2019.12.14
[iOS] alamofire에서 response의 request 보기  (0) 2019.12.14
iOS UUID 가져오기  (0) 2019.12.13
firebase push 메모장  (0) 2019.12.13
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함