Search code examples
iosnotificationsuilocalnotificationsimulatorlocalnotification

UILocalNotification doesn't fire on ios9 device (banner not showing)


This notification is perfectly fires on Simulator (9.2) and doesn't fire on iPhone 6(9.2):

UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.alertBody = NSLocalizedString(@"You are going to be disconnected. To continue being online, please open the application",nil);
[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];

and I'm calling this code from:

- (void)applicationDidEnterBackground:(UIApplication *)application {
[self performSelector:@selector(sendLocalNotification) withObject:nil afterDelay:5];
}

Remote notifications work fine for all customers


Solution

  • the problem was that i used performSelector but should use performSelectorInBackground

    performSelector doesn't work if app in background