2013-07-28 1 views
0

을 작동하지 않습니다 :내 localNotification 내가 내 localNotification을 포함 코드를 다음있어

-(void)scheduleNotification{ 

    if (self.shouldRemind && [self.dueDate compare:[NSDate date]] != NSOrderedAscending){ 

     UILocalNotification *localNotification = [UILocalNotification new]; 
     localNotification.fireDate = self.dueDate; 
     localNotification.timeZone = [NSTimeZone defaultTimeZone]; 
     localNotification.alertBody = self.text; 
     localNotification.soundName = UILocalNotificationDefaultSoundName; 
     localNotification.userInfo = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.itemId] forKey:@"ItemId"]; 

     NSLog(@"Scheduled notification %@ for itemId %d", localNotification, self.itemId); 

    } 
} 

다음 말한다 NSLog에서 내 출력 :

2013년 7월 28일 15 : 39 : 48.684 JuneChecklist [2271를 : 907] 예정된 알림 {fire date = воскресенье, 2013 년 28 월 28 일, 15:40:33 시간대 = 유럽/모스크바 (GMT + 04 : 00) 오프셋 14400, 반복 간격 = 0, 반복 횟수 = UILocalNotificationInfiniteRepeatCount , 다음 화재 날짜 = воскресенье, 2013 년 5 월 28 일, 15:40:33 Московское стандартное врем 사용자 정보 = { 항목 Id = 0; }} itemId 0

하지만 표시되지 않습니다 (iPhone 및 시뮬레이터에서 실행 앱을 시험해 보았습니다). NSLog에서 fireDate가 완벽하게 표시되는 이유가 궁금하지만 그 때까지 기다릴 때 알림이 없습니다.

모든 조언을 주시면 감사하겠습니다.

답변

1

하지만 [[UIApplication sharedApplication] scheduleLocalNotification : localNotification];은 어디에 있습니까?

+0

감사합니다. 그 코드 덩어리는 튜토리얼에서 가져온 것입니다. 왜 저자가 그렇게 간단한 것을 잊어 버렸는지 궁금합니다. –

관련 문제