【笔记】IOS_超时检测
NSDate *m_date = [[NSDate alloc] init];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
while (YES)
{
if ([m_date timeIntervalSinceNow] < -5.0)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示信息" message:@"超时提示" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
dispatch_async(dispatch_get_main_queue(), ^{
[alertView show];
});
break;
}
}
});
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.