J'ai besoin d'aide pour terminer ce code afin que l'application affiche le numéro de badge quand une notification push est reçue, je peux recevoir une notification push, mais pas de badge sur l'application, voici le CodeComment mettre à jour le numéro de badge lorsque vous recevez une notification push
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping
(UIBackgroundFetchResult) -> Void) {
if let aps = userInfo["aps"] as? NSDictionary, let _ = aps["alert"] as? String, let sound = aps["sound"] as? String
{
if let systemSound = SystemSoundID(sound) {
AudioServicesPlayAlertSound(systemSound)
}
NotificationCenter.default.post(name: Notification.Name(rawValue: SystemSetting.refreshCouponListNotification), object: nil)
completionHandler(UIBackgroundFetchResult.newData)
}
}
Vous pouvez suivre ce tutoriel https://eladnava.com/send-push-notifications-to-ios-devices-using-xcode-8-and-swift- 3/et https://stackoverflow.com/questions/44490391/swift-3-turn-off-badge-alert-sound – iPatel