In iOS9 fordern wir unseren Benutzer auf, Benachrichtigungen zu erhalten und sie auf die Einstellungsseite zu leiten, damit sie die Benachrichtigungsberechtigung für unsere App aktivieren können. Wie unten gezeigt, gibt es keine Option, um Benachrichtigungen in meinen Apps-Berechtigungseinstellungen innerhalb von iOS 10 zu aktivieren. Gibt es einen neuen Prozess, den ich durchführen muss, um diese Liste mit den entsprechenden Berechtigungen zu füllen?Wie aktiviere ich Benachrichtigungen für iOS 10?
-Code
//check the notifications status. First the global settings of the device, then our stored settings
func checkGlobalNotifications() {
let grantedSettings = UIApplication.sharedApplication().currentUserNotificationSettings()
if grantedSettings!.types.rawValue & UIUserNotificationType.Alert.rawValue != 0 {
globalNotificationsEnabled = true
//if global notifications are on, then check our stored settings (user)
if CallIn.Settings.notificationsEnabled { notificationsOn() } else { notificationsOff() }
}
else {
globalNotificationsEnabled = false
//global notifications (iOS) not allowed by the user so disable them
notificationsOff()
}
}
Ich möchte hinzufügen, dass die 'UIApplication.shared.registerForRemoteNotifications()' sollte nach 'gewährt erfolgen == wahr ' – KVISH