In order to present local notifications to the user, you have to register your app with the device:
let settings = UIUserNotificationSettings(forTypes: [.Badge, .Sound, .Alert], categories: nil) UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
This will present an alert the first time it is called:
Regardless of what the user chooses, the alert will not show up again and changes will have to be initiated by the user in Settings.