[英]Why is involving a special character from another language creating a crash when I try to call api in iOS SWIFT?
這是罪魁禍首字符串,參數名稱= solsssㅗ
Alamofire.request(todoEndpoint)
.responseJSON { response in
// check for errors
guard response.result.error == nil else {
// got an error in getting the data, need to handle it
print("error calling GET on \(todoEndpoint)")
print(response.result.error!)
DispatchQueue.main.async
{
self.activityView.isHidden = true
self.activityView.stopAnimating()
}
return
}
因此,我總是在URL中收到錯誤消息,始終是無效的。 如果我不帶任何特殊字符使用它,則效果很好。
您可以嘗試使用String url-
let urlWithSpecialCharacter = url.addingPercentEncoding( withAllowedCharacters: .urlQueryAllowed)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.