【发布时间】:2017-03-15 21:58:25
【问题描述】:
谁能告诉我为什么我的通话“超时”?我的应用只是挂在那里,以下代码的success:^(NSURLSessionTask* operation, id response) 部分从未执行。
return [self beginRequestController:@"myController" action:@"myAction" parameters:parameters
success:^(NSURLSessionTask* operation, id response)
{
NSLog(@"This is NOT being called --->>>: %@", response);
} failure:^(NSURLSessionTask* operation, NSError* error)
{
//Handle the error
}];
- (NSOperation*) beginRequestController:(NSString*)controller action: (NSString*)action parameters:(NSDictionary*)parameters success: (RequestSuccess)success failure:(RequestFailure)failure
{
NSOperation *operation = [AFHTTPSessionOperation operationWithManager:manager HTTPMethod:@"POST" URLString:urlString parameters:parameters uploadProgress:nil downloadProgress: nil success:^(NSURLSessionDataTask *task, id responseObject) {
NSLog(@"Reponse --->>>: %@", responseObject );
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"Error --->>>: %@", error);
}];
[self.operationQueue addOperation:operation];
return operation;
}
【问题讨论】:
-
只有一个操作。我确实尝试将 maxConcurrentOperationCount 限制为 1,但它并没有解决我的问题。没有错误信息。我真的不知道从这里去哪里。
-
谢谢@Rob,它没有从第一次调用中击中成功块,没有失败,实际上它从第二次调用中执行了成功块,但在那之后,它只是无限期地冻结并且最终超时。令我困惑的是为什么在第二次调用成功完成后它没有返回到第一个成功块?它也没有从第一次调用中执行失败块。
标签: afnetworking