gpt4 book ai didi

ios - 如何每隔x次自动调用函数

转载 作者:技术小花猫 更新时间:2023-10-29 10:41:40 28 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
How to call function in every “X” minute?

如何定时调用某个函数?

- (void)viewDidLoad
{
[super viewDidLoad];
[self checkAlert];
}



-(void)checkAlert{
// Server output Alert Note
NSString *alert_note_hostStr = @"http://www.loxleyintranet.com/MobileApplication/xml/alert_note.php";
NSData *alert_note_dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:alert_note_hostStr]];
NSString *alert_note_serverOutput = [[NSString alloc] initWithData:alert_note_dataURL encoding:NSASCIIStringEncoding];

if ([alert_note_serverOutput isEqualToString:@"0"]) {
alertImage.hidden = YES;
alertLabel.hidden = YES;
underMainBG.hidden = YES;
alertLabel.text = [NSString stringWithFormat:@"No Alert"];
}else{
alertLabel.text = [NSString stringWithFormat:@"You've Got Note (%@)" ,alert_note_serverOutput];

}
}

如何每 x 分钟或秒调用一次 [self checkAlert];

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com