Здравствуйте, я использую alamofire и swift 4, и я пытаюсь сделать запрос на получение некоторых данных от API от сервера, и ответ должен быть только строкой, включающей некоторое число, когда я получаю ответ, он дает мне HTML, я не знаю, почему это не происходит, потому что в Android-приложении он приходит правильно тот же URL-адрес и те же заголовки
вот мой код alamofire:
let getBalanceUrlStr = URLs.URL_GET_BALANCE + userDefaul.getLoggedUserDetails().emailStr!
print(getBalanceUrlStr)
let headers = ["Authorization":"bearer " + self.userDefaul.getLoggedUserDetails().accessToken!]
print(headers)
AFManager.strRequestGETURL(getBalanceUrlStr, headers: headers, success: { (response) in
//progressHUD.hide()
print("responseee \(response)")
self.refreshControl.endRefreshing()
}) { (error) in
//progressHUD.hide()
print(error)
self.refreshControl.endRefreshing()
}
AFManager является классом для управления запросами, здесь код запроса
import UIKit
import Alamofire
import SwiftyJSON
class AFManager : NSObject{
class func strRequestGETURL(_ strURL : String, headers : [String : String]?, success:@escaping (JSON) -> Void, failure:@escaping (Error) -> Void){
Alamofire.request(strURL, method: .get, encoding: URLEncoding.default , headers: headers).responseString { (responseObject) -> Void in
print(responseObject)
if responseObject.result.isSuccess {
let resJson = JSON(responseObject.result.value!)
success(resJson)
}
if responseObject.result.isFailure {
let error : Error = responseObject.result.error!
failure(error)
}
}
}
вот что я получаю
responseee <!DOCTYPE html>
<head>
<title>The resource cannot be found.</title>
<meta name="viewport" content="width=device-width" />
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
@media screen and (max-width: 639px) {
pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
}
@media screen and (max-width: 479px) {
pre { width: 280px; }
}
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>The resource cannot be found.</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
<br><br>
<b> Requested URL: </b>/Website/Index<br><br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2623.0
</font>
</body>
</html>
пожалуйста, помогите мне, в чем может быть проблема? заранее спасибо