【笔记】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;
        }
    }
});

你可能感兴趣的:(ios,超时检测)