Not Receiving Push Notifications on iOS

Following the guide on Capacitor’s site for push notifications, I am unable to receive any push notification inside my iOS device.

I’ve triple checked that the Apple Push key and sandbox/production certificates are uploaded

image

I have successfully registered to the APNs and get a token value, but when I use Firebase to send a message to the token, I receive no notification.

I’ve also tried to send a message directly using this solution Apple Push Notification Using ASP.Net and I can send the message successfully, but I receive no response at all.

My app capabilities:

If you are using Firebase, then you need to make sure you are using the Firebase token and not the iOS APN token (reference).

Your AppDelegate.swift needs to look like this:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
  Messaging.messaging().apnsToken = deviceToken
  Messaging.messaging().token(completion: { (token, error) in
    if let error = error {
        NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
    } else if let token = token {
        NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: token)
    }
  })
}

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
  NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
}

I’ve tried that following this guide: Capacitor - build cross platform apps with the web

Hmmm…that is the guide that I followed as well. I am using the “APNs Authentication Key” in Firebase and didn’t upload any APNs Certificates.

I am assuming you are using a physical iOS device? Push notifications don’t work/aren’t supported with the emulator.

Have you tried sending a push notification directly from the Firebase admin panel?

Correct, I have my iPhone connected to my mac.