이것은 내 localNotification 코드입니다.NSLocalNotifications에 대한 몇 가지 질문
NSDate *currentDate = [NSDate date];
NSCalendar * calendar = [NSCalendar currentCalendar];
[calendar setTimeZone:[NSTimeZone systemTimeZone]];
NSDateComponents* components = [calendar components:NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:currentDate];
[components setTimeZone:[NSTimeZone systemTimeZone]];
[components setHour:13];
[components setMinute:11];
[components setDay: sonOdemeGunuNumber.integerValue -3];
NSDate *test = [calendar dateFromComponents:components];
// Schedule the notification
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = test;
localNotification.alertBody = [NSString stringWithFormat:@"%@ 3 days left.",_txtBankaAdi.text];
localNotification.alertAction = @"Show item";
localNotification.timeZone = [NSTimeZone systemTimeZone];
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
localNotification.repeatInterval = kCFCalendarUnitDay;
localNotification.repeatInterval = kCFCalendarUnitMonth;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
sonOdemeGunuNumber는 ToDoItem 경고 일 (예 : 오늘 날 수 -3)입니다.
if(sonOdemeGunuNumber.integerValue == currentDay.integerValue){
localNotification.repeatInterval = nil; }
내가 3 일 이전에 사용자에게 통보하고 싶어하며 currentDay = sonOdemeGunuNumber 때까지 경고를받을 계속해야합니다.
1-이 if-else 문을 쓰면 작동할까요?
2- 사용자가 내 TableView에서 localNotification 항목을 삭제 한 경우이 경우 항목은 은행 계좌입니까? 은행 계좌 localNotification이 자동으로 삭제됩니까?
감사합니다. 이 좋은 하루 모두 ...