2011-08-06 2 views
11

알람 목적으로 UILocalNotification을 사용하고 있습니다. 평일 (일, 월, 화, 수, 목, 금, 토) 기반의 반복에 대한 사용자 정의 옵션이 있습니다. 많은 응용 프로그램이이 과정을 수행했습니다. 나는 나의 최고 수준을 시험해 보았다. 그러나 나는 그것을 작동시킬 수 없다. 너희들이 날 도와 줘 ....맞춤 알람 (태양, 월, 화, 수, 목, 금, 토)에 대한 UILocalNotification 반복 간격

답변

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에는 사용자 정의 시간 간격 옵션 + (instancetype)을 가진 새로운 반복 알림 옵션이 있습니다. triggerWithTimeInterval : (NSTimeInterval) timeInterval repeats : (BOOL) repeats; –

2

간단히 매개 변수 간격과 평일을 사용하여 메소드를 작성하십시오.

  [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]; 

나는 평일을 통과 : 그리고 과 방법은 아래 내가 전화 한 separately.As 해결 될 수있다 유 평일에 대한 알림을 alarm.But 설정해야 할 때마다 기능 를 호출 다른 요일의 매개 변수는 월요일에 2, 화요일에 3 등입니다.

I hope it will help u...!