1
有人可以告訴我爲什麼我的電話「超時」?我的應用程序掛在那裏,成功:^(NSURLSessionTask *操作,ID響應)部分的代碼從未執行。使用AFHTTPSessionOperation時超時
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,但並未解決我的問題。沒有錯誤消息。我真的不知道該從哪裏出發。 – Aviva
謝謝@Rob,從第一次調用沒有觸及成功塊,沒有失敗,實際上它從第二次調用執行成功塊,但之後,它只是無限期地凍結並最終超時。我困惑的是爲什麼在第二次調用成功完成後,它沒有返回到第一個成功塊?它也沒有從第一次調用執行失敗塊。 – Aviva