UILocalNotification is not displayed in iOS7

I am using UILocalNotification in my project. My code is:

        UILocalNotification *notification = [[UILocalNotification alloc] init];
        notification.fireDate = event.date;
        notification.timeZone = [NSTimeZone systemTimeZone];        

        notification.hasAction = YES;
        notification.soundName = UILocalNotificationDefaultSoundName;
        [notification setApplicationIconBadgeNumber:[UIApplication sharedApplication].applicationIconBadgeNumber+1];

        notification.alertBody = @"test alert body";

        notification.repeatInterval = NSDayCalendarUnit;

        NSLog(@"SCHEDULED NOTIFICATION  = %@", notification);

        [[UIApplication sharedApplication] scheduleLocalNotification:notification];

At the time of the notification, nothing happens, but the icon icon of the application icon gets +1. For iOS6, it works fine. Where could the problem be?

UPDATE I do not receive any notification notifications while my application is running and when it is closed. The number of the icon. They are changing.

+4
source share
3 answers

If you use it in the foreground often, it is didReceiveLocalNotificationmissing:

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:[[[NSBundle mainBundle] infoDictionary]   objectForKey:@"CFBundleName"]
                                                        message:notification.alertBody
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];

    [alertView show];

    // Reset badges if you want
    application.applicationIconBadgeNumber = 0;
}
0
source

, push- . , " Push-", ; push local.

- > - > . , , , , push -_-

0

All Articles