Sebastian Dwornik
Sebastian Dwornik

Reputation: 2576

Why don't I receive iOS Push Notifications with a debug build connected to Xcode debugger?

When I test the app using a TestFlight version built by the CI machine, the device receives push notifications.

But when I rebuild the app under Xcode locally with the debugger connected, the device doesn't receive any push notifications.

To validate things further I again tested locally with a push notifications tester, and the device indeed received a push notification.

So the code isn't omitted due to it being a #DEBUG build as the grant and registrations pass.

What is my local build possibly missing?

Upvotes: 10

Views: 7995

Answers (2)

Sebastian Dwornik
Sebastian Dwornik

Reputation: 2576

The solution ended up being that our server with the Houston gem needed to configure its APNS support to be in development mode, and not in production mode. 👍

Upvotes: 2

Cameron Porter
Cameron Porter

Reputation: 959

When you build your app in debug locally your app will generate a unique device token that doesn't receive production push notifications. When you build your app with a distribution provisioning profile it generates a different device token that does work on production.

Apple will reject a development device token unless you are specifically requesting a push notification using your APNS Sandbox certificate.

So if you haven't already you'll have to go through the certificate creation process all over again but this time for a sandbox certificate and use that one instead.

Upvotes: 4

Related Questions