gpt4 book ai didi

ios - 预先通知

转载 作者:行者123 更新时间:2023-12-01 19:09:11 25 4
gpt4 key购买 nike

是否可以将应用设置为在指定时间从自身发送通知?也许将他们排在队列中?到目前为止,我必须经过一个推送通知服务器,当我在每个星期二早上发送消息时,这似乎已被淘汰。另外,这叫什么(以便我可以更好地在网络上进行研究)

最佳答案

您可以像这样安排通知:

- (void)scheduleNotification
{
//Cancel all previous Local Notifications
[[UIApplication sharedApplication] cancelAllLocalNotifications];

//Set new Local Notifications
Class cls = NSClassFromString(@"UILocalNotification");
if (cls != nil)
{
UILocalNotification *notif = [[cls alloc] init];
//3 days
notif.fireDate = [NSDate dateWithTimeInterval:60.0f*60.0f*24.0f*3.0f sinceDate:[NSDate date]];
notif.timeZone = [NSTimeZone defaultTimeZone];
notif.alertBody = @"Come Back Again! Lets blast All Zombie!";
notif.alertAction = @"PLAY";
notif.soundName = UILocalNotificationDefaultSoundName;
notif.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
}
}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[application registerForRemoteNotificationTypes:
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound];

[self scheduleNotification];
..
}

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

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