Solved

Push notifications on iOS not work in debug mode

  • 25 May 2023
  • 7 replies
  • 608 views

Badge

Hi there, I’ve implemented Klaviyo integration. It’s correctly work with TestFlight/AppStore build’s. But if I’m trying to send notification to locally built app - I see “Invalid push token” inside dashboard. How can I fix this?

icon

Best answer by Brian Turcotte 26 May 2023, 18:42

View original

7 replies

Userlevel 7
Badge +36

Hi @Korpyc!

 

Do you have notifications disabled on your testing device? That’s one reason an invalid token might occur.

Another issue could be that the app is foregrounded (i.e., open on the device) when the notification is delivered. It is best to have the app backgrounded (i.e., closed) and the phone locked when testing if notifications are delivered successfully.
 

Also, here’s our Help Center article on the topic, if you haven’t already seen it:


If none of the above causes apply, then we can take a deeper look at your integration. I hope this helps get you started!

- Brian

Userlevel 3
Badge +4

Hi @Korpyc ,

I’m the Klaviyo product manager for mobile push notifications. I’m assuming when you’re trying to send a notification to a local build that you’re trying to use the APNs Sandbox environment. We do not currently support Sandbox tokens, but this functionality is coming very soon. Until then, you should use TestFlight builds to ensure that push notifications are working correctly through Klaviyo if you want to test before fully publishing your app.

Thanks,

Mark

 

Badge +1

Hi @Korpyc ,

I’m the Klaviyo product manager for mobile push notifications. I’m assuming when you’re trying to send a notification to a local build that you’re trying to use the APNs Sandbox environment. We do not currently support Sandbox tokens, but this functionality is coming very soon. Until then, you should use TestFlight builds to ensure that push notifications are working correctly through Klaviyo if you want to test before fully publishing your app.

Thanks,

Mark

 

Hi Mark,

Can you further detail the “very soon”-piece above? I’m working with React Native and without APNs Sandbox support it is really hard to test and debug.

Also, a question for engineering: I struggle to collect the “_k” property on iOS, so I can do a custom $opened_push event. It works great on Android, but I struggle to capture the property on iOS specifically. Without APNs sandbox it is really hard to test and debug.

Userlevel 3
Badge +4

@jenssoegaard We now support sending to Apple Sandbox as long as you are using v2.2.0 or higher of the Klaviyo Swift SDK. With that version and above, we automatically collect the environment for each token when you send it to Klaviyo, so when you try to send to a token, we funnel sends to the right environment. If you’re building a wrapper / bridge for React Native to the Swift SDK, I believe this functionality should still work.

Also for testing purposes, you may want to make use of our new feature that enables sending preview notifications. https://help.klaviyo.com/hc/en-us/articles/18011985278875

Badge +1

@jenssoegaard We now support sending to Apple Sandbox as long as you are using v2.2.0 or higher of the Klaviyo Swift SDK. With that version and above, we automatically collect the environment for each token when you send it to Klaviyo, so when you try to send to a token, we funnel sends to the right environment. If you’re building a wrapper / bridge for React Native to the Swift SDK, I believe this functionality should still work.

Also for testing purposes, you may want to make use of our new feature that enables sending preview notifications. https://help.klaviyo.com/hc/en-us/articles/18011985278875

That’s perfect. Was already using the preview since Android don’t have the same limitations around debug/production, but this makes things easier.

I’m still unable to preview push notifications in local iOS builds using version 2.2.1. It always shows the red error banner in the dashboard mentioned above. From what you all are saying here, it seems like this should be working?

Badge +1

I’m still unable to preview push notifications in local iOS builds using version 2.2.1. It always shows the red error banner in the dashboard mentioned above. From what you all are saying here, it seems like this should be working?

I can confirm that it is working, assuming the push token gets registered correctly in Klaviyo (I register the token using API calls, not using Klaviyo’s iOS and Android packages).

Reply