1
我發出本地通知提醒(iOS 5中),將通過加入[[UIApplication sharedApplication] scheduleLocalNotification:
唯一項和「按repeatInterval」
UILocalNotification
實例設置
repeatInterval
定期(每分鐘),直到用戶確認其重複其提醒
設置'repeatInterval'的效果是每次重複通知而不確認時,通知中心還有另一個條目。例如:5分鐘內沒有進行射擊,通知中心有5個單獨的條目。
有沒有辦法只有一個入口,但每隔1分鐘發出一次聲音/振動警報?
下面是我如何創建本地通知:
UILocalNotification *localNotify = [[UILocalNotification alloc] init];
localNotify.fireDate = aFireDate;
localNotify.timeZone = [NSTimeZone defaultTimeZone];
localNotify.userInfo = userInfo;
// 3. Configure the substance of the notification: alert, icon badge number, and sound.
localNotify.alertBody = NSLocalizedString(alertTitleText, nil);
localNotify.alertAction = NSLocalizedString(alertActionText, nil);
localNotify.soundName = UILocalNotificationDefaultSoundName;
localNotify.applicationIconBadgeNumber = 1;
localNotify.repeatInterval = NSMinuteCalendarUnit;
// Schedule the local notification for delivery.
[[UIApplication sharedApplication] scheduleLocalNotification:localNotify];