Ad

Failing APNS For Independent WatchOS6 App

- 1 answer

After setting up a new independent WatchOS6 app, which now supports push notifications, getting the device to request the user for push notifications and capturing the push token. I can’t get my server to send a push notification.

With all the correct credentials and P8 set up on my NodeJS server, I have tried to push messages to the device... This is the error all the time:

Status 400 - DeviceTokenNotForTopic - Which according to Apple’s documentation, means that the Topic (BundleId of the app) is wrong. But in this case it is not.

Tried 2 different NPM packages (for elimination)

https://www.npmjs.com/package/node-pushnotifications

https://www.npmjs.com/package/apn

Both providing me with the same issue.

Has anyone successfully managed to complete a Independent WatchOS app with APNs? What am I missing

———

Update

To test the node service, a further 2 tests have been made:

  1. Created a new app, iOS this time, with the same Bundle Identifier, using the pushToken and sending a message the service was successful

  2. Created a new app, another watchOS, with a different Bundle Identifier, this was again rejected but the APNs for the same DeviceTokenNotForTopic issue.

To test production, the only way current is to submit to the store for App Store review. TestFlight option is currently not available for the Watch and there is no way to install a production ad-hoc .ipa manually. Once it is in the store I will continue with further tests.

Ad

Answer

Problem has been solved.

Xcode has a couple of issues, if you rely on Xcode to sort out your certificates in the developer portal then please don't.

I have been in touch with support and after a few days back and forth with logs it has been made aware that:

  1. Apple's documentation for Independent WatchOS applications does not state anywhere that the topic (which is the bundle id) should be the one ending in .watchkitapp
  2. Xcode does not allow you to add the Push Notification Capability to the .watchkitapp thus meaning it never creates the AppId in your developer portal.

The solution to the problem, I had, was to manually go to the developer portal and add the .watchkitapp AppId and create the certificates, thus allowing my p8 certificate on the server to allow pushes to that particular application.

Ad
source: stackoverflow.com
Ad