几分钟隔几分钟发送请求循环

//每隔五分钟发送ping
//- (void)handleNormalThreadButtonTouchUpInside
//{
// NSLog(@"Enter handleNormalThreadButtonTouchUpInside");
//
//
// NSLog(@"Start a New Normal Thread");
// NSThread *normalThread = [[NSThread alloc] initWithTarget:self selector:@selector(handleNormalThreadTask) object:nil];
// [normalThread start];
//
// //等待线程完成再执行以下任务,在这种情况下会阻塞UI线程
//// while (!self.normalThreadDidFinishFlag) {
// [NSThread sleepForTimeInterval:0.5];
//// }
//
// //直到线程执行完成,才会打印handleNormalButtonTouchUpInside中的输出信息
// NSLog(@"Exit handleNormalThreadButtonTouchUpInside");
//}
//-(void)handleNormalThreadTask{
//
// while (1) {
// NSLog(@"请求");
// NSMutableDictionary *mDict = [NSMutableDictionary dictionary];
// mDict[@"dwID"] = [DWUserInfo sharedDWUserInfo].dwID;
// mDict[@"info"] = @"";
// NSLog(@"id%@",[DWUserInfo sharedDWUserInfo].dwID);
// [DWHttpTool post:ping params:mDict success:^(id json) {
// NSLog(@"ping = %@", json);
//
// NSLog(@"循环请求");
//
// } failure:^(NSError *error) {
// [MBProgressHUD showError:@"在线请求错误"];
// }];
// sleep(300);
//
// }
//
//
//
//}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • iOS开发系列--网络开发 概览 大部分应用程序都或多或少会牵扯到网络开发,例如说新浪微博、微信等,这些应用本身可...
    lichengjin阅读 3,726评论 2 7
  • NSThread 第一种:通过NSThread的对象方法 NSThread *thread = [[NSThrea...
    攻城狮GG阅读 859评论 0 3
  • 218.241.181.202 wxhl60 123456 192.168.10.253 wxhl66 wxhl6...
    CYC666阅读 1,454评论 0 6
  • 1.OC里用到集合类是什么? 基本类型为:NSArray,NSSet以及NSDictionary 可变类型为:NS...
    轻皱眉头浅忧思阅读 1,396评论 0 3
  • //swift中的线程延时 //在主线程中延迟执行某动作,不会卡主主线程,不影响后面的东做执行 //在子线程中执行...
    KUANGJUNJIE阅读 807评论 0 0