Question: The app should send a local notification to the user when the app is in the background...

i have followed every tutorial there is, i am doing exactly as the tutorials say and **i dont have any errors after writing the code or warnings** **but the Local notifications still wont appear after trying everything.**

i am using xcode 6, running ios8 on the test device i have even tried running on the simulator and still nothing. please help. i have tried atleast 5 different ways to get local notifications working but still nothing however i have no errors... **what should i add or what arent i doing?**

To test that the fault that this isnt working isnt mine, i have:
**-Tried restarting xcode
-Tried rebooting my device and simulator
-Tried using the code on a new project 
-Tried rebooting my mac**
But still the notifications wont appear... i have a feeling it might be ios8 issue or xcode6 issue

here is the code in AppDelegate.m

```
- (void)applicationDidEnterBackground:(UIApplication *)application {

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
[localNotification setFireDate: [NSDate dateWithTimeIntervalSinceNow:15]];
[localNotification setAlertBody:@"this is a test notification"];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
[[UIApplication sharedApplication]scheduleLocalNotification:localNotification];

```

}

Answer: 
Add this to your didFInishLaunchingWithOptions method in your app delegate:

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

```

In iOS 8, I am not 100% sure but it may be required to put that piece of code before local notifications are allowed to work.
Since the Notifications are changed in iOS 8.0, add this in your AppDelegate didFinishLaunchingWithOptions: 

```
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
    // iOS 8 Notifications
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

    [application registerForRemoteNotifications];
}
else
{
    //iOS Version < 8.0 Notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (
      UIRemoteNotificationTypeBadge |
      UIRemoteNotificationTypeSound |
      UIRemoteNotificationTypeAlert)];
}

```