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];

            }

            

        }

     

    }

  • 相关阅读:
    form表单介绍
    if条件语句
    表格.html
    列表.html
    CSS Js链接HTML文件
    DQL
    mysql介绍
    第一次接触mysql
    逻辑运算、作用域问题、DOM
    Js数据类型具体分析
  • 原文地址:https://www.cnblogs.com/Xujg/p/5536753.html
Copyright © 2011-2022 走看看