0

Dans ios 10 il y a UNUserNotificationCenter classe et la méthode getNotificationSettingsWithCompletionHandler qui vous donne UNNotificationSettings objet et vous pouvez vérifier est l'utilisateur a déjà été demandé pour les notifications push notifications.Y a-t-il un moyen d'y parvenir pour iOS 9 et iOS 8 .notification push non déterminée

Répondre

0

Il n'y a aucun moyen. Cette fonctionnalité est disponible à partir de ios 10.

1

Vous pouvez utiliser quelque chose comme ceci:

let notificationType = UIApplication.sharedApplication().currentUserNotificationSettings()!.types 

if notificationType == UIUserNotificationType.None { 
    // Push notifications are disabled in setting by user. 
} else { 
// Push notifications are enabled in setting by user. 
} 

if notificationType != UIUserNotificationType.None { 
    // Push notifications are enabled in setting by user. 
} 

if notificationType == UIUserNotificationType.Badge { 
    // the application may badge its icon upon a notification being received 
} 

if notificationType == UIUserNotificationType.Sound { 
    // the application may play a sound upon a notification being received 
} 

if notificationType == UIUserNotificationType.Alert { 
    // the application may display an alert upon a notification being received 
}