Swift request code:
import Alamofire
let parameters:[String : Any] = [
"action": "login",
"login": "admin",
"password": "admin"
]
let urlString = "localhost:8888/index.php"
Alamofire.request(urlString, method: .post, parameters: parameters).responseJSON { response in
switch response.result.isSuccess {
case true:
print("!")
case false:
print(response.result.error!)
}
}
error code:
Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSUnderlyingError=0x6080000576d0 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "(null)"}, NSErrorFailingURLStringKey=localhost:8888/index.php, NSErrorFailingURLKey=localhost:8888/index.php, NSLocalizedDescription=unsupported URL}