2012-03-06 33 views
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]; 

回答

1

遺憾的是沒有。只要用戶已爲您的應用啓用了通知中心,您觸發的每個本地通知都將顯示爲通知中心中的獨特條目;即使它們是同一個UILocalNotification對象的多個觸發器。 UILocalNotification API讓你無法控制這一點。

相關問題