如何从AFNetworking 3.x中的故障块获取响应字符串,
在2.x版本中,这样做的方法是:
[manager GET:path parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSDictionary *dictionary_FetchResult = responseObject;
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSDictionary *dictionary_FetchResult = operation.responseObject;
}];
Run Code Online (Sandbox Code Playgroud)
但是在3.x版本中,返回块的参数中没有操作,如下所示:
[manager POST:path parameters:parameters progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSDictionary *dictionary_FetchResult = responseObject;
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"Error: %@", error);
}];
Run Code Online (Sandbox Code Playgroud)
所以我希望有人能够做到这一点.