有沒有辦法每隔10分鐘設置本地通知重複間隔。我怎樣才能每10分鐘使用重複間隔?
我嘗試使用
localnotification.repeatInterval = NSMinuteCalendarUnit*3;
和
localNotif.repeatInterval = 640;
,它不工作。
所以請你指導我。 :)
有沒有辦法每隔10分鐘設置本地通知重複間隔。我怎樣才能每10分鐘使用重複間隔?
我嘗試使用
localnotification.repeatInterval = NSMinuteCalendarUnit*3;
和
localNotif.repeatInterval = 640;
,它不工作。
所以請你指導我。 :)
我認爲你不能這樣做。
我問過類似的問題之前,如果你想提及這個問題。
這裏是鏈接
How to set Local Notification repeat interval to custom time interval?
希望這有助於你。
NSTimeInterval
是在幾秒鐘內,所以十分鐘將是600.0
,而不是640
。
NSMinutesCalenderUnit
具有任意定義的值並且不包含每分鐘的秒數。
你檢查,你安排的通知與scheduleLocalNotification:
適當,是可以實現在你的AppDelegate application:didReceiveLocalNotification:
?
如芒迪說,按repeatInterval必須是NSCalendarUnit
並且只能包含:NSWeekCalendarUnit
,NSMonthCalendarUnit
,NSDayCalendarUnit
,NSHourCalendarUnit
,..
所以得到一個通知,每隔10分鐘。使用6個通知,重複每個小時,並在通知之間設置10分鐘。
你會不會有shedule您的通知藏漢?像這樣
[[UIApplication的sharedApplication] scheduleLocalNotification:localNotification];
請檢查出答案並標記爲一個答案。 –