2015-01-21 67 views

回答

0

我已经使用以下hack实现了这种功能。

- (void)application:(UIApplication *)application didReceiveLocalNotification 
(UILocalNotification *)notification 
{ 
    if ([notification.alertBody isEqualToString:@"your notification's alertBody"]) 
    { 
     //reschedule your notification for 2 months 
    } 
} 

只是在你的应用程序的委托appdelegate.m

+0

的比较时,用于识别通知已被炒到推通知网络服务?没有比alert机体更加优雅的方式吗? – mrd 2015-01-21 12:14:48

+0

我使用了alertBody,因为它在我的情况中是独一无二的。你是否使用了一些类似的LocalNotification的alertBody? – 2015-01-21 12:16:08

+0

是的,它是确定localnotification – 2015-01-21 12:16:32

0

用上面的方法不幸的是不可能的。 NSCalendarUnit仅适用于单位重复。
考虑到您无法安排超过64个本地通知,您有3种可能性。

  1. 如果你知道,绝不会超过这个限制,安排所有的通知要求
  2. 做一个算法,安排刚刚通知的量,当用户在您的应用程序中输入删除旧的通知,并重新安排多个通知。要做到这一点识别每个通知与一个ID并将其附加到信息词典。
  3. 创建注册用户选项,并使用一台服务器需要(推送通知)