ios 开启线程定时请求某个方法

来源:互联网 发布:淘宝签收超过7天 退货 编辑:程序博客网 时间:2024/05/22 13:07


- (void)startLoop

{

        [NSThreaddetachNewThreadSelector:@selector(loopMethod)toTarget:selfwithObject:nil];

}


- (void)loopMethod

{

    [NSTimerscheduledTimerWithTimeInterval:3.0ftarget:selfselector:@selector(requestIsHaveReview)userInfo:nilrepeats:YES];

    NSRunLoop *loop = [NSRunLoopcurrentRunLoop];

    [loop run];

}

0 0
原创粉丝点击