【筆記】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;
}
}
});
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.