我在单例模式下使用AFHTTPSessionManager,并启动多个请求,如:
[MyAPI testSlow];
[MyAPI testQuick];
MyAPI定义:
+(void)testSlow {
AFHTTPSessionManager *manager = [BPNetworkManager sharedManager]; // Get Manager Singleton
NSString *urlString = [BPCommonUtils getUrlByPath:@"/api/test/testSlow"];
[manager GET:urlString parameters:nil success: ^(NSURLSessionTask *operation, id responseObject) {
NSLog(@"slowSuccess");
} failure:^(NSURLSessionTask *operation, NSError *error){
NSLog(@"slowFail");
}];
}
+(void)testQuick {
AFHTTPSessionManager *manager = [BPNetworkManager sharedManager];
NSString *urlString = [BPCommonUtils getUrlByPath:@"/api/test/testQuick"];
[manager GET:urlString parameters:nil success: ^(NSURLSessionTask *operation, id responseObject) {
NSLog(@"quickSuccess");
} failure:^(NSURLSessionTask *operation, NSError *error){
NSLog(@"quickFail");
}];
}
当“快速任务”成功返回时,“慢速任务”立即失败,消息信息失败: @“NSURLErrorDomain” - 代码:18446744073709550617
@“NSLocalizedDescription”:@“已取消”
我该如何解决?谢谢!