2014-09-22 2 views
0

내 응용 프로그램에는 아주 가까운 '발사 일'과 함께 여러 로컬 알림이 매우 근접하게 발생하는 시나리오가있을 수 있습니다.iOS >> UILocalNotification을 잃어 버렸습니다.

앱이 포 그라운드에있는 경우 AppRegeiveLocalNotification 메소드를 통해 AppDelegate가 앱을 모두 포착 한 것으로 보입니다.

하지만 앱이 배경 화면에 있거나 닫힌 경우 홈 화면에서 팝업되는 '팝업'을 클릭하면이 방법은 첫 번째 알림 만 캡처하고 나머지는 사라지는 것처럼 보입니다. 그리고 나는 그들 모두가 필요합니다 ...

누구?

+0

NSNotification의 userInfo를 사용할 수 없습니까? –

답변

0

로컬 알림의 경우 아래에서 시도하셨습니까?

NSArray *pendingNotifications = [[[UIApplication sharedApplication] scheduledLocalNotifications] sortedArrayUsingComparator:^(id obj1, id obj2) { 
     if ([obj1 isKindOfClass:[UILocalNotification class]] && [obj2 isKindOfClass:[UILocalNotification class]]) 
     { 
      UILocalNotification *notif1 = (UILocalNotification *)obj1; 
      UILocalNotification *notif2 = (UILocalNotification *)obj2; 
      return [notif1.fireDate compare:notif2.fireDate]; 
     } 

     return NSOrderedSame; 
    }]; 
// if there are any pending notifications -> adjust their badge number 
if (pendingNotifications.count != 0) 
{ 
    //do something 
}