Cancel Post request in Afnetworking 2.0

后端 未结 2 1585
清歌不尽
清歌不尽 2021-01-13 10:26

Hi I am making post request using AFnetworking 2.0. My request looks like this.

 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager mana         


        
相关标签:
2条回答
  • 2021-01-13 10:33

    Tried [manager.operationQueue cancelAllOperations] ?

    0 讨论(0)
  • 2021-01-13 10:46

    POST method return the AFHTTPRequestOperation operation. You can cancel it by calling cancel.

    AFHTTPRequestOperation *post =[manager POST:nil parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
      //doing something
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
       // error handling.
    }];
    
    //Cancel operation
    [post cancel];
    
    0 讨论(0)
提交回复
热议问题