swati
swati

Reputation: 57

Push notification is coming in one device, but not in another device

Push notification is coming on my iPhone and iPad, but it is not coming on another iPhone when I send it. I can't understand why it's not coming. I have created all the required certificates. add device ids. Still its not coming.Please help.(It's in sandbox mode).

I'm getting the following error when I'm trying to send notification using https://pushtry.com

ERROR Response Command: 8 Identifier: 0 Status: 8-Invalid token

Upvotes: 0

Views: 640

Answers (1)

Ashwin Shrestha
Ashwin Shrestha

Reputation: 528

Steps:

  1. Check if the same provisioning profile is being used while installing app in all your device

  2. if its same.. go to developer.apple.com to see if the all your devices are checked in, for the provisioning profile you are using

  3. Now in debug mode, check if

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    var deviceTokenStr = deviceToken.description.replacingOccurrences(of: ">", with: "", options: .caseInsensitive, range: nil)
    deviceTokenStr = deviceTokenStr.replacingOccurrences(of: "<", with: "", options: .caseInsensitive, range: nil)
    deviceTokenStr = deviceTokenStr.replacingOccurrences(of: " ", with: "", options: .caseInsensitive, range: nil)
    print(deviceTokenStr)
    }
    

this method is geting called, i.e all your devices are geting registered for push notification service

now, inside the above method, get your push notification token "deviceToeknStr" and use it to check the push notification using site

https://pushtry.com

using your pem file, passphrase for the certificate and the devicetokenStr, in debug mode.

Upvotes: 2

Related Questions