FCM push notifications are not working on TestFlight after some time - swift

I have uploaded a build to Testflight and started testing the push notifications which were developed using Firebase. I used distribution certificate for TestFlight build and also set the setApnsToken to prod. The entitlement file is generated by enabling push notifications and background mode with Remote Notification.
While testing, i have received 23 notifications and then it suddenly stopped receiving notifications.
I checked the device token n it's registered. The device token is same for both i.e. for successfully delivered notifications and failed to receive notifications.
I tried for 2 days but the same thing is happening.
Note.-
I am using the single device to test.
I am sending device token at the time of login by using InstanceID.
The device token is cleared on user logout at the server side.
The device token is always registered at the time of login (checked the entries at server side).
Any help is very much appreciated. THANKS IN ADVANCE

Related

Independent Watchkitapp APNS push notification successful send but notification does not receive in Apple Watch

I have created an independent watchkitapp in XCode, installed in apple watch and successfully sent push notification without errors from Pusher app (also in node-apn) but the notification does not arrive in app. (Tried another app for iOS and remote push notification successfully received in iOS app)
These are the steps i took
In my watchkitapp I did WKExtension.shared().registerForRemoteNotifications() and took the device token
UNUserNotificationCenter.current().requestAuthorization and allowed push notification on apple watch. ofcourse I set UNUserNotificationCenter.current().delegate to the InterfaceController (I tried Local Notification and local notifications display normally on the watch)
On XCode watchkitapp.watchkitextension I added Push Notification on capabilities
In Apple Developer page I created app id mirroring the watchkitapp bundle (not the watchkitextension one). In my case apple automatically created App Id in the server but I removed and recreated it to make sure
Checked the Apple Push Notification service and generated Development SSL Cert
Downloaded the Development SSL Cert and installed in keychain
Opened the Pusher app and selected the installed Development SSL Cert from the list. Ran the apple watch app and obtained the Token Id... sent the payload and it says the payload is sent
Tried to restart mac, iphone, apple watch, unpairing apple watch, reinstalling app but the result is the same... push is sent but does not receive in apple watch
anybody can help me how can I fix this?
Finally, I got this successfully. I use node-apn to send from server.
Here are the worth noticing things:
create app id of the watchkitapp bundle in Apple Developer page
install the latest version of: node-apn,
"dependencies": {
"apn": "git+https://github.com/node-apn/node-apn.git#3.0.0",
[...]
}
should set apns-push-type
notification.pushType
(Required when delivering notifications to devices running iOS 13 and later, or watchOS 6 and later. Ignored on earlier system versions.)
The type of the notification. The value of this header is alert or background. Specify alert when the delivery of your notification displays an alert, plays a sound, or badges your app's icon. Specify background for silent notifications that do not interact with the user.
The value of this header must accurately reflect the contents of your notification's payload. If there is a mismatch, or if the header is missing on required systems, APNs may delay the delivery of the notification or drop it altogether.

APNS Apple Push Notification token goes stale and stops working

Does anyone know what could cause a Apple Push Notification token to go stale? After some time the Push token no longer works for a given device, while other tokens work. If I delete that account for that device and create a new account for that device and receive a new Push token from Apple, then the new Push token works fine.
Edit 1 - This post claims that push notification connections fail after 200 notifications and the connection has to be restarted. Has anyone else had this experience?
Could the Push token go stale because Apple saw the Push connection for that device being brought up and down too often in a given period of time? If so, is there some way to programmatically know when a Push token has gone stale?
Your application should register for push notifications every time it is launched. This way you will get the current device token every time it is launched, and if it changes (you can store the old copy in the app in order to know that), you can send it to your server.
You can see a related answer with quotes from the APNS guide here.

Push notification data when app is not running?

When the app is not running and user receives, say 5 push notifications, are those push notifications saved somewhere? Or is that data gone? I need to access all 5 push notifications when the app runs the next time.
To clarify, I already understand that you can access the push notification that caused the app to run. What I'm asking is to get all push notifications since the app got terminated.
The APNS service will only retain the most recent pushed message to a device - assuming there is still at least one other app installed AND the user allows push notifications for it, then this one stored message will be delivered the next time the user has an Internet connection.
For better information on the quality of service that Apple has implemented for the APNS service, see my other answer here:
Clarification on Apple APNS

How to register device token in Urban Airship for Push Notification?

I am using Urban airship for sending push notification, and i successfully achieved this. Now i am stuck an issue that before registering device token into urban airship i couldn't able to send broadcast, if i am wrong on this then how can i can send notifications into many devices in which my app is installed without registering their device tokens?
hey You have to register your app as In production, connecting to real push servers. and check out this link http://docs.urbanairship.com/build/push/index.html
it may be helpful to you
The broadcast should work in development mode as well.
When you login to "go" do you see your "Device Tokens" listed under your app? The other thing that could be a problem is if you have recently switch your app from development to production - if you try and send device tokens to APNS that are not mis-matched (production device tokens sent to sandbox vice-versa) you'll run in to this issue and likely see some sporadic results.
If you are in dev mode, you could simply delete the existing device tokens then get a few re-registered, then retry a broadcast.

Testing Apple Push Notifications Feedback - no items received

How to test feedback.sandbox.push.apple.com? Everything goes right, but I receive empty list.
How to make it consider the device token as inactive?
I installed the application to iPhone using Xcode, received some push notifications, then removed it from iPhone and send some more notifications. But even on the next day feedback.sandbox.push.apple.com returns just empty set.
Issues with Using the Feedback Service
If you remove your app from your device and then send a push notification to it, you would expect to have the device token rejected, and the invalidated device token should appear on the feedback service. However, if this was the last push-enabled app on the device, it will not show up in the feedback service. This is because deleting the last app tears down the persistent connection to the push service before the notice of the deletion can be sent.
You can work around this by leaving at least one push-enabled app on the device in order to keep the persistent connection up. Just install any free push-enabled app from the App Store and you should then be able to delete your app and see it appear in the feedback service.
source:
http://developer.apple.com/library/ios/technotes/tn2010/tn2265.html#TNTAG34
I far as I found, Apple push notification feedback service doesn't work properly on sandbox mode. You should try it on ad-hoc or production mode.