3
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
在我使用的會話管理器調用同步請求的應用程序,我使用的是全球
@property(strong,nonatomic)AFHTTPSessionManager *manager;
,並在viewDidLoad中分配像
manager = [[AFHTTPSessionManager alloc] init];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
AFJSONResponseSerializer *responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:NSJSONReadingAllowFragments];
[manager setResponseSerializer:responseSerializer];
和一組請求正在一個週期中發生。有對我取消我的所有要求的選項,其中我做
for (manager in self.arrayOfTasks) {
[manager invalidateSessionCancelingTasks:YES];
}
manager=nil;
,但問題是取消也是這個請求再次發生,again.it不cancelling.can任何人引導我找到後我哪裏錯了?
看到這個http://stackoverflow.com/questions/39092183/cancel-all-operations-afnetworking-3-0 –