2011-08-06 106 views

回答

24

你不能設置自定義重複間隔UILocalNotification。之前已經詢問過(見下文),但只提供了有限的選項。 repeatInterval parameter是一個枚舉類型,它僅限於specific values

您不能乘以這些枚舉並獲得這些間隔的倍數。您的應用中不能設置超過64個本地通知。除非用戶選擇在通知觸發時運行應用程序(它們可能無法運行它),否則一旦觸發它就不能重新安排通知。

有重複間隔乘數posted here的要求。您可以添加評論。我建議向蘋果提交一個錯誤報告或功能請求(url?)。

+4

蘋果[文件](https://developer.apple.com/library/ios/documentation/iphone/conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072 -CH4-SW5)表示**一個應用程序可以同時安排128個本地通知**:_您的應用程序在任何給定時間不能有超過128個本地通知活動,其中任何一個可以配置爲在指定的時間重複interval._ – nburk

+0

@nburk評論中的鏈接不再有效。你碰巧知道你說的話是否仍然準確? – ndmeiri

+1

iOS 10有一個新的重複通知選項,其自定義時間間隔選項+(實例類型)triggerWithTimeInterval:(NSTimeInterval)timeInterval重複:(BOOL)重複; –

2

只需製作參數爲interval和weekday的方法。並調用 功能每u必須設置爲alarm.But平日 的通知時間下面給出的方法 將被解決separately.As我呼籲:

  [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:2 :tempDict] andRepeatInterval:NSWeekCalendarUnit]; 
      [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:3 :tempDict]andRepeatInterval:NSWeekCalendarUnit]; 
      [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:4 :tempDict] andRepeatInterval:NSWeekCalendarUnit]; 
      [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:5 :tempDict] andRepeatInterval:NSWeekCalendarUnit]; 
      [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:6 :tempDict] andRepeatInterval:NSWeekCalendarUnit]; 

我通過平日星期一的不同日子參數爲2,星期一爲 ,星期二爲3,等等。

I hope it will help u...! 
相關問題