ios - AFNetworking 3.0 状态码
<p><p>我正在使用 AFNetworking 3.0,但无法获取成功或失败的状态码。</p>
<pre><code>AFHTTPSessionManager *manager = ;
parameters:parameters progress:^(NSProgress * _Nonnull downloadProgress) {
// TODO: show progress somewhere
} success:^(NSURLSessionDataTask * _Nonnull task, id_Nullable responseObject) {
NSLog(@"%@",responseObject);
// get status here
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
// get status here
}];
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p><strong>这是工作代码:</strong></p>
<pre><code>[afHttpSessionManager GET:@"blablabla/bla" parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {
// success
} failure:^(NSURLSessionTask *operation, NSError *error) {
// failure
NSHTTPURLResponse *response = (NSHTTPURLResponse *) ;
NSInteger statusCode = ;
NSLog(@"RESPONSE CODE: %i", statusCode);
}];
</code></pre></p>
<p style="font-size: 20px;">关于ios - AFNetworking 3.0 状态码,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/34945289/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/34945289/
</a>
</p>
页:
[1]