0

In ios 10 gibt es UNUserNotificationCenter Klasse und Methode getNotificationSettingsWithCompletionHandler was gibt Ihnen UNNotificationSettings Objekt und Sie können überprüfen, ist Benutzer jemals für Push-Benachrichtigungen Berechtigungen gefragt.Ist es eine Möglichkeit, dies für iOS 9 und iOS 8 zu erreichen .Push-Notification nicht bestimmt

Antwort

0

Es gibt keine Art und Weise ist. Diese Funktionalität ist ab ios 10 verfügbar.

1

Sie können so etwas wie folgt verwenden:

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 
} 
Verwandte Themen