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];
}
}
}
最新文章
- UIActivityViewController(转)
- SymPy库常用函数
- [Letcode] 1. Two Sum
- 升级web项目步骤
- opencl 在vs2015上遇见的问题
- hdu2896
- 在使用hibernate的getHibernateTemplate()时怎么让控制台输出封装好的SQL? 怎么用日志打印出来?
- BZOJ 1115: [POI2009]石子游戏Kam [阶梯NIM]
- 《阿里巴巴Android编码规范》阅读纪要(二)
- 转 Eclipse快捷键调试大全
- Linux ip配置
- [Abp 源码分析]四、模块配置
- Android 修改 Menu字体颜色
- gitlab+jenkins+tomcat CI/CD 部署
- python函数练习——个人信息修改
- php和js字符串的acsii码函数
- Javascript 对象的创建和属性的判定
- swagger报错No handler found for GET /swagger-ui.html
- MVC ---- EF4.0和EF5.0增删改查的写法区别及执行Sql的方法
- Git_标签管理