Local Notification not working since updating to IOS 8 and Xcode 6

2 Solutions Collect From Internet About “Local Notification not working since updating to IOS 8 and Xcode 6”

You need to update your code to be able to receive notifications in iOS8. More info here.

Objective-C code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
    }
    // Override point for customization after application launch.
    return YES;
}

Swift Code:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
//registering for sending user various kinds of notifications
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound|UIUserNotificationType.Alert |UIUserNotificationType.Badge, categories: nil)   
// Override point for customization after application launch.     
return true
}

In order to receive Local NSNotification, follow the below steps:

  1. Add code into your appDelegate.h in didFinishLaunchingWithOptions method

    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
          [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
    }