gpt4 book ai didi

ios - UI本地通知

转载 作者:行者123 更新时间:2023-11-29 02:55:42 28 4
gpt4 key购买 nike

我想在我的游戏中安排本地通知。
游戏结束两小时后会收到第一个通知。
在那之后,如果仍然没有游戏,另一个将在接下来的 24 小时内出现。如果游戏重置为 2 小时后,则每 24 小时重置一次,直到他们进入游戏。如果你能帮助我,我将不胜感激。
这是我的代码:

UILocalNotification *notif = [[UILocalNotification alloc] init];
notif.alertBody = [self.notifyArray objectAtIndex:index];

NSTimeInterval sec = 7200;
notif.fireDate = [NSDate dateWithTimeIntervalSinceNow:sec];
notif.repeatInterval = NSDayCalendarUnit;
notif.soundName = UILocalNotificationDefaultSoundName;
NSLog(@"notif : %u",notif.repeatInterval);
notif.applicationIconBadgeNumber += 1;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];

//notif.fireDate = [NSDate dateWithTimeIntervalSinceNow:20];
//[[UIApplication sharedApplication] scheduleLocalNotification:notif];

最佳答案

首先尝试通过检查预定通知列表进行调试。详情可以看这个帖子iOS find list of Local Notification the app has already set

关于ios - UI本地通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23932143/

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