【发布时间】:2015-08-06 04:28:42
【问题描述】:
我目前正在使用 Django Rest 框架为后端 API 设置 iOS 应用程序。当我使用的 url 明显存在时,我收到 -1011, request not found 错误。
控制台输出:
Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: not found (404)"
UserInfo={com.alamofire.serialization.response.error.response<NSHTTPURLResponse:0x12d797940>
{ URL: https://myurl.com/users/login/ }
{ status code: 404, headers {
Allow = "POST, OPTIONS";
Connection = "keep-alive";
"Content-Type" = "application/json";
Date = "Thu, 06 Aug 2015 04:12:34 GMT";
Server = "Apache/2.4.12 (Amazon) mod_wsgi/3.5 Python/2.7.9";
"Transfer-Encoding" = Identity;
Vary = "Accept,Cookie";
"X-Frame-Options" = SAMEORIGIN;
} },
NSErrorFailingURLKey=https://myurl.com/users/login/,
com.alamofire.serialization.response.error.data=<7b226d73 67223a22 536f7272 792c2079 6f757220 75736572 6e616d65 2c656d61 696c206f 72207061 7373776f 72642069 7320696e 636f7272 6563742e 227d>, NSLocalizedDescription=Request failed: not found (404)}
2015-08-06 00:12:35.070 Tumvi[10963:3903454] Failed To Login
我已经使用 chrome 上的 Rest 客户端扩展测试了端点,正如我之前提到的,模拟器 IOS8.4 和另一部非 ios9 手机上完全相同的代码运行没有任何问题。
老实说,我似乎无法弄清楚可能是什么问题。感谢您的帮助!
【问题讨论】:
-
错误描述性再好不过了。
404表示 url:https://myurl.com/users/login/中没有可服务的内容 -
这让我感到困惑,在任何其他设备上相同的代码,相同的 url 确实可以正常服务。我什至将确切的 url 复制到 Advanced Rest Client 并能够获得正确的请求。
-
您必须为您的经理设置安全策略。去stackoverflow.com/questions/22695625/…看看吧
标签: ios objective-c json django afnetworking