Ios AF2重试模式

Ios AF2重试模式,ios,afnetworking-2,Ios,Afnetworking 2,我使用的是AFNetworking 2.2.3,AFNetworking+AutoRetry 0.0.3和AFKissXMLRequestOperation@aceontech0.0.4 我有以下代码从服务器获取数据: + (void)doNetwork { AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer = [

我使用的是
AFNetworking 2.2.3
AFNetworking+AutoRetry 0.0.3
AFKissXMLRequestOperation@aceontech0.0.4

我有以下代码从服务器获取数据:

+ (void)doNetwork {
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [AFKissXMLResponseSerializer serializer];
    NSDictionary *param = [NSDictionary dictionaryWithObjectsAndKeys:@"someValue", @"someKey", nil];
    [manager POST:@"http://example.com/api/" parameters:param success:^(AFHTTPRequestOperation *operation, id responseObject) {
      NSError *error;
      DDXMLDocument *xml = [[DDXMLDocument alloc] initWithXMLString:operation.responseString options:0 error:&error];
      if(error != nil) {
        NSLog(@"Error Parsing XML");
        [[NSNotificationCenter defaultCenter] postNotificationName:@"FetchAPINotification" object:nil];
      } else {
        NSString *xPath = @"response/status";
        NSArray *arr_status = [xml nodesForXPath:xPath error:nil];
        if(arr_status == nil || arr_status.count == 0) {
          NSLog(@"Status Not Found");
          [[NSNotificationCenter defaultCenter] postNotificationName:@"FetchAPINotification" object:nil];
        } else {
          int status = [[arr_status objectAtIndex:0] intValue];
          if(status == 0) { // OK
            [[NSNotificationCenter defaultCenter] postNotificationName:@"FetchAPINotification" object:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"OK", @"status", nil];
          } else if(status == 123) { // Requires Re-login
            [self doLogin];
            // How should I call the method again?
            [self doNetwork];
          } else {
            [[NSNotificationCenter defaultCenter] postNotificationName:@"FetchAPINotification" object:nil];
          }
        }
      }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
      NSLog(@"Network Error");
      [[NSNotificationCenter defaultCenter] postNotificationName:@"FetchAPINotification" object:nil];
    } autoRetry:3];
}
解释如下:

首先,我使用
AFHTTPRequestOperationManager
param
发出HTTP POST请求。然后,在成功块中,如果状态为0,则向预定义的通知观察者发布通知以标记成功

如果有任何错误,我会发布一个没有
userInfo
的通知,以标记操作不成功

然而,有一种情况是,当服务器响应状态=123时,这意味着用户令牌已过期,必须重新登录以刷新其令牌

我的问题是:重新登录后如何重新尝试该操作

注意:我不是说网络超时重试,我已经实现了