Симулятор Iphone: локальное уведомление срабатывает дважды, но никогда не отображается? - PullRequest
0 голосов
/ 25 августа 2010

Есть ли ошибка в симуляторе и локальных уведомлениях или я что-то делаю неправильно.

// on button click fire off notification for 30 seconds from now
-(IBAction)scheduleNotification{
    UILocalNotification *localNotif = [[UILocalNotification alloc] init];

    NSDate *item = [NSDate dateWithTimeIntervalSinceNow:30]; 

    if (localNotif == nil)
        return;     
    localNotif.fireDate = item;
    localNotif.timeZone = [NSTimeZone defaultTimeZone];
    localNotif.alertBody =  NSLocalizedString(@"Test Notification", nil);
    localNotif.alertAction = NSLocalizedString(@"View Details", nil);
    localNotif.soundName = UILocalNotificationDefaultSoundName;
    localNotif.applicationIconBadgeNumber = 0;
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
    [localNotif release];
}   



- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
    // Handle the notificaton when the app is running
    NSLog(@"Recieved Notification %@",notif);
}

didReceiveLocalNotification регистрирует 2 уведомления, но симулятор никогдана самом деле отображает уведомление.

Recieved Notification <UIConcreteLocalNotification: 0x5943450>{fire date = 2010-08-25 09:36:25 -0400, time zone = America/New_York (EDT) offset -14400 (Daylight), repeat interval = 0, next fire date = 2010-08-25 09:36:25 -0400}

Recieved Notification <UIConcreteLocalNotification: 0x5c53e00>{fire date = 2010-08-25 09:36:25 -0400, time zone = America/New_York (EDT) offset -14400 (Daylight), repeat interval = 0, next fire date = (null)}

1 Ответ

2 голосов
/ 08 октября 2010

Вы не увидите никаких предупреждений, если получите локальное / push-уведомление во время работы приложения. Если вы не показываете свое собственное предупреждение в приложении: didReceiveLocalNotification: конечно.

...