【问题标题】:Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: not found (404)"错误域=com.alamofire.error.serialization.response Code=-1011 “请求失败:未找到 (404)”
【发布时间】:2018-02-26 04:55:11
【问题描述】:

我正在使用 CordovaHttp 插件在我的 Cordova 应用程序中基于 angular1 进行 API 调用。我正在使用以下 URL 以用户名和密码作为参数进行身份验证的发布请求。

https://xxxx.xxxx.com:443/xxx/v3/xxx/Authentication/signin 

在 android 和 Postman 中发出请求时一切正常。但是当我在 ios 上发出相同的请求时,它会失败并出现以下错误:

Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: not found (404)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x60800002e160> { URL: https://xxxx.xxxx.com:443/xxx/v3/xxx/Authentication/signin  } { status code: 404, headers {
    "Content-Length" = 817;
    "Content-Type" = "text/html";
    Date = "Sun, 17 Sep 2017 15:37:12 GMT";
    Server = "Microsoft-IIS/8.0";
} }, NSErrorFailingURLKey=https://xxxx.xxxx.com:443/xxx/v3/xxx/Authentication/signin 

如果我从上面的 url 中删除端口 443,一切正常。我不知道为什么 iOS 会发生这种情况以及如何解决这个问题。

我想使用端口号,因为我的应用程序使用不同的服务器配置和不同的端口号,具体取决于客户端。

【问题讨论】:

    标签: ios cordova alamofire


    【解决方案1】:

    错误表明 - 找不到您尝试访问的资源。

    发生这种情况的原因有很多,其中一些可能是 -

    【讨论】:

    • 正如我所说,如果我从 url 中删除端口 443,api 就可以工作。那么您仍然认为它是内容类型问题吗?因为我已经尝试过很多人了
    猜你喜欢
    • 1970-01-01
    • 2014-12-01
    • 2021-09-12
    • 1970-01-01
    • 2016-11-23
    • 1970-01-01
    • 1970-01-01
    • 2018-08-28
    • 1970-01-01
    相关资源
    最近更新 更多