Receiving "DeviceTokenNotForTopic" when pushing to watchOS only app - ios

I am trying to receive push notifications in a watchOS-only app and I am getting DeviceTokenNotForTopic when using the sandbox server and BadDeviceToken when using the production one. I am using the keyId + key certificate (*.p8) method and I am pushing using an http2 client from Node.js (apns2). I have experimented with adding and removing the .watchkitextension suffix from the topic but I am still getting the same result. I have verified that the APNS client is adding correctly the apns-topic and apns-push-type headers
For the record, I have successfully pushed notifications using the same route to an iOS-only app (with different keyId/key and bundle name).
Has anyone experienced something similar?
Any thoughts would be appreciated.
UPDATE 10/18/20
Follow the workarround solution presented in Failing APNS for Independent WatchOS6 app. It seems that XCode does not include Push Notification entitlements to .watchkitapp extension.

Related

react-native-push-notification remote doesn't show when I test with real ios device with xcode

I'm using react-native-push-notification.
I'm trying to test push notifications, if I build app and upload it to testflight it shows remote notifications just fine, but when I do it with xcode build on a real device it doesn't react at all (I'm getting onRegister call and notification token though). This problem is only on IOS, android getting notifications in production and development. Can't google anything related so probably I'm missing something.
P.S. I'm using backend to send notifications through firebase
you have to go in capaibility in xcode and active PushNotification first
for more info see this
hope you have followed all the steps to get the APNS certificate and attached that to your xcode, before the build, if not please do so.
Also, in addition you need to have .pem file to add to your Firebase to make your ios app enable to send and receive push.

iOS VoIP Notifications not working on newly created app

I have an old app that have VoIP implemented. Everything is working just fine. Now I'm creating a new one - new app in App Store(new bundle id), new certificates. I've never managed to receive a single voip notification in that app.
However if I put the old bundle id (from the old app that's working) as Bundle Identifier in the new app - it starts to receive the VoIP notifications. So the problem isn't in the new app code base.
I have created everything identical to the old one - certificates, capabilities, code.
Does anyone have experienced this?
Any solutions and suggestions are highly welcomed.
Check the server code which is sending voip. Check if the server is using new bundle id and certificates of the app. Ass you said, problem is not in your app code. It should be on server end.
So yesterday I've submitted a ticket to apple. They said:
Based on your reports that your Push Notifications have stopped working without any changes on your end, we suspect this could be due
to continued use of the legacy Binary Interface which was retired
March 31st, 2021 (https://developer.apple.com/news/?id=c88acm2b).
This change requires you to migrate your push servers to use the
HTTP/2 API. Any push servers still using the legacy interface will be
unable to connect to APNs, resulting in Push Notifications not
working.
More information about the HTTP/2 provider API can be found in these
two WWDC sessions:
WWDC2015 Whats New in Notifications https://developer.apple.com/videos/play/wwdc2015/720/
WWDC2016 Whats New in the Apple Push Notification Service https://developer.apple.com/videos/play/wwdc2016/724/
After migrating to HTTP/2 the pushes started working.

Flurry send test push message stopped working

In my project sending Flurry campaigns to a specific iOS device using Push Token stopped working suddenly.
I have previously configured Flurry with an Apple Push Services certificate for production and an Apple Development iOS Push Services for development. Both certificates are still valid.
When trying to send the push message to my device using Push Token, we get this error message:
Unable to send test push. Please try again
I'm at a loss what the error could be here, especially since it worked fine before. Any ideas?
After some weeks Flurry support managed to solve this. Meaning we did not have any faulty configurations.

Phonegap PushPlugin can't receive notifications ios

I am developing a Phonegap application for both Android and iOS and would like to enable push notifications for both.
The app is using the Phonegap plugin PushPlugin which sets it to receive notification for both Android and iOS.
I am having issue with the iOS version of the app. When running it, I get the screen asking if I want to allow the app to receive notifications, I select yes then I receive a device token which is then used on the server side to send the notification to the selected device. This was a good indication that the Phonegap plugin was working.
Server side, I am using AmazonSNS to send the notifications. (Java code of this can be downloaded here.)
With AmazonSNS I need to pass in:
certificate (created in the online iOS development center)
private key (exported from the certificate)
device token (from PushPlugin)
to send the notification.
I followed this detailed tutorial on how to get the app id, certificate, private key and provisioning profile all set up.
The problem is, after sending the notification, not only does the app not receive the notification, but sending the notification doesn't error or give me any feedback as to what might have went wrong.
I'll also point out, the Android version of the app is successfully receiving notifications using the same java code.
Any advice on what the issue here might be would be great.
Thanks
I managed to work out what the problem was.
In my server-side plugin, I was trying to connect to APNS directly, but what I should of been doing was connecting to APNS_SANDBOX.

Attempting to sent Push Notifications to iOS device - not receiving them

I have so far done the following:
- Generated certificate and private key as .pem, also cat'd them together. Successfully connected to gateway.sandbox.push.apple.com.
- Using the provisional profile with push notifications is enabled for development, I have a basic app that successfully prompted "Do you want to allow push notifications", so this is working correctly
- Obtained the device token
- I have tried pulling a few pre-made files for SSLing into sandbox from the internet just to see if I can get them running before I start development.
The files are the php file posted here: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12. I actually got a "Message successfully sent"
The python file posted here: Apple PNS (push notification services) sample code; I had to edit the Python 3 command "fromhash" line to str(float.fromhash(...))
I also tried using the PyAPNs API: https://github.com/simonwhitaker/PyAPNs. I still have use_sandbox set to true.
Obviously I changed the device tokens and public keys/certificates to my own. Sadly I have not received any pushed notifications yet, and I'm not receiving any concrete errors to tell me why. If anyone can shed some light, that would be amazing.
From my comment in radesix's answer, and apologies that I can provide no more detail as it's been a year since I've touched iOS development.
The problem was my provisional profile had the "aps-environment" key set to developer, but for some reason xcode defaulted to "debug". Changing this in the editor solved my problem.
Use a service like urban airship (urbanairship.com) and you'll have this up and running in minutes. Less for you to maintain in the long run also.

Resources