iOS 12 Push Notifications are not working and working in below versions , Push notification not receiving in iOS 12
Asked Answered
I

1

9

For iOS 12 Push Notifications are not working and working in below versions

My App is in Appstore. Push notification is working fine in iOS 11, but in iOS 12 it is not working. I am not receiving any push notification for iOS 12 devices. I have checked the device token and certificate in my server. All are correct. I have also checked the notification properties in settings app. All are fine. But I didn't receive any notification.

This is the code i used for push notifications.

Can you please suggest me what would be the issue. How to Fix This?

func registerForPushNotifications() {

    if #available(iOS 10.0, *){

        let center = UNUserNotificationCenter.current()
        center.delegate = self
        center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
            if (granted)
            {
                UIApplication.shared.registerForRemoteNotifications()
            }
            else{
                //Do stuff if unsuccessful...
                 UIApplication.shared.registerForRemoteNotifications()
            }
            // Enable or disable features based on authorization.
        }
    }
    else
    {

        let types: UIUserNotificationType = [UIUserNotificationType.badge, UIUserNotificationType.alert, UIUserNotificationType.sound]
        let settings: UIUserNotificationSettings = UIUserNotificationSettings( types: types, categories: nil )
        UIApplication.shared.registerUserNotificationSettings( settings )
        UIApplication.shared.registerForRemoteNotifications()

    }

}



@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {

    let userInfo = response.notification.request.content.userInfo as NSDictionary

    print(userInfo)


}
Inform answered 25/9, 2018 at 11:11 Comment(6)
see this for help : #39383352Prone
@Anbu.karthik push notifications are working below iOS 12 versions both background and foreground, the issue is only with iOS 12.Inform
give the time, I will check and update youProne
did you find a solution to your issue?Harte
@SandeepBaddula Have you found any solution ?Quantic
@Sandeep Baddula did you solve this problem?Mizzenmast
C
3

I had the same problem when my app running in "debug",
I run app in "release" and notification worked fine

Chemosphere answered 21/10, 2018 at 16:34 Comment(1)
Hi, for me also the push notifications are not working, if we build the project from xcode it is not woorking, if i build the project from command prompt then the notifications are coming. i am using firebase push notifications in ionic framework version 3. i updated my mac ios version to 12 and the xcode version to 10, then notifications stopped working.. can any help to sort out of this problem...Scalable

© 2022 - 2024 — McMap. All rights reserved.