zoukankan      html  css  js  c++  java
  • ios 中尝试多次请求

    -(void)tryRun

    {

        tryTimes++;

        id obj = [ASODataManager getAppleAccount];

        if (obj) {

            __block FirstViewController* sf = self;

            //有账号,可以开始获取数据

            [[ASODataManager sharedManager] fetchASOTaskListWithCompletionHandler:^(NSArray *data) {

                NSMutableArray* arr = [[NSMutableArray alloc] initWithCapacity:[data count]];

                for (id obj in data) {

                    if ([[obj objectForKey:@"isFinished"] integerValue] == 0) {

                        [arr addObject:obj];

                    }

                }

                

                sf->task = [arr copy];

                if ([sf->task count] <= 0) {

    //                [[[UIAlertView alloc] initWithTitle:@"提示" message:@"当前无任务" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show];

                    [[KengSDKToolsiToast makeText:@"当前无任务"] show];

                }

                [sf.MainTableView reloadData];

            }];

        }else{

            //没有账号,连续三次

            if (tryTimes <= 3) {

                [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(tryRun) userInfo:nil repeats:NO];

            }

            

        }

     

    }

  • 相关阅读:
    男人应该懂得的
    喝酒礼仪
    Office Web Apps开放测试
    SAP系统概要
    SAP实施成功的关键因素
    SAP企业实施的方法论
    ASAP
    ERP系统的组成部分
    去除word的保护
    实习周小结
  • 原文地址:https://www.cnblogs.com/Xujg/p/5536753.html
Copyright © 2011-2022 走看看