Afnetworking获取方法错误未经授权(401)

时间:2014-09-10 06:55:52

标签: ios iphone afnetworking-2

在从AFNetworking发出Get请求时,我在error.userInfo中收到此响应。

  "Request failed: unauthorized (401)" UserInfo=0x17d296c0 {NSErrorFailingURLKey=http://futstepz.node.com/emap/api/v1/users/friend_list_page?auth_token=xyz, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x17d9f5e0> { URL:http://futstepz.node.com/emap/api/v1/users/friend_list_page?auth_token=xyz } { status code: 401, headers {
    "Cache-Control" = "no-cache";
    Connection = "Keep-Alive";
    "Content-Length" = 74;
    "Content-Type" = "application/json; charset=utf-8";
    Date = "Wed, 10 Sep 2014 06:42:27 GMT";
    Server = "WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)";
    "X-Content-Type-Options" = nosniff;
    "X-Frame-Options" = SAMEORIGIN;
    "X-Request-Id" = "51544d50-3d1b-4b54-b8c9-34540b73e695";
    "X-Runtime" = "0.007077";
    "X-Ua-Compatible" = "chrome=1";
    "X-Xss-Protection" = "1; mode=block";
} }, NSLocalizedDescription=Request failed: unauthorized (401)}

我正在使用此代码;

 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

manager.requestSerializer = [AFJSONRequestSerializer serializer];


[manager GET:@"http://futstepz.node.com/emap/api/v1/users/friend_list_page?auth_token=xyz" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) 

0 个答案:

没有答案