我正在使用与iOS 8.4中使用的客户端相同的客户端,但客户端无法在iOS 9中使用。
相同的代码在iOS 8.4中有效,但它在iOS 9中不起作用我不知道,但我的应用停止工作很奇怪。
从iOS 9开始,我们必须在我设置的info.plist中设置安全密钥,但客户端仍无法正常工作。
我收到以下错误:
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: unauthorized (401)" UserInfo={com.alamofire.serialization.response.error.response= { URL: https://api.xing.com/v1/request_token } { status code: 401, headers {
"Cache-Control" = "no-cache";
Connection = "Keep-Alive";
"Content-Encoding" = gzip;
"Content-Length" = 93;
"Content-Type" = "application/json; charset=utf-8";
Date = "Tue, 01 Sep 2015 06:29:16 GMT";
"Keep-Alive" = "timeout=5, max=56";
Server = Apache;
"Set-Cookie" = "c_=baca882ff97bd2cf6a18b395933613a0; domain=.xing.com; path=/; expires=Mon, 27 Aug 2035 06:29:16 -0000; secure; HttpOnly";
Status = "401 Unauthorized";
Vary = "Accept-Encoding";
"X-Content-Type-Options" = nosniff;
"X-Frame-Options" = SAMEORIGIN;
"X-Logjam-Request-Action" = "WebService::OauthController#request_token";
"X-Logjam-Request-Id" = "xws-production-85b5a502132e496daedb58968863026a";
"X-Powered-By" = "Phusion Passenger 4.0.59";
"X-Request-Id" = "e82a4a5e-5876-4e1d-9017-85dbbbd1a0f4";
"X-Runtime" = "0.012464";
"X-XSS-Protection" = "1; mode=block";
} }, NSErrorFailingURLKey=https://api.xing.com/v1/request_token, com.alamofire.serialization.response.error.data=<7b226d65 73736167 65223a22 496e7661 6c696420 4f417574 68207369 676e6174 75726522 2c226572 726f725f 6e616d65 223a2249 4e56414c 49445f4f 41555448 5f534947 4e415455 5245227d>, NSLocalizedDescription=Request failed: unauthorized (401)}
我在info.plist中添加了以下代码:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
我使用以下网址中的推荐代码: