LoginSignup
0
2

More than 5 years have passed since last update.

AFNetworking の failureブロックで response の body を取得する方法

Posted at

やりたいこと

AFNetworking の failureブロックで response の body を取得したい

方法

以下の方法で取得可能。

} failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSData* data = error.userInfo[AFNetworkingOperationFailingURLResponseDataErrorKey];
        NSString* body = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
        NSLog(@"%@",body);
}];
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2