簡體   English   中英

在iOS中保存本地通知

[英]Save Local Notification in ios

如何保存本地通知? 我想再次使用本地通知生效日期來安排本地通知。

您應該使用UILocalNotification

請查看文檔: https : //developer.apple.com/library/ios/documentation/iPhone/Reference/UILocalNotification_Class/

它看起來像:

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = dateTime;
localNotification.alertBody = [NSString stringWithFormat:@"Alert Fired at %@", dateTime];
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

關於通知重新安排周期:

發出通知不足以顯示另一個通知。 除非用戶點擊通知,否則不會啟動您的應用程序。 您可以為下個月的每天或每周預先安排一個通知,如果用戶打開一個通知,則可以取消安排。 根據您的需要,您還可以使用content-available鍵觸發remote notification ,該remote notification將在后台啟動您的應用,並允許您重新安排新的本地通知。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM