Skip to main content
Solved

Push notifications on iOS not work in debug mode


Forum|alt.badge.img+1

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?

Best answer by Brian Turcotte

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

View original
Did this topic or the replies in the thread help you find an answer to your question?

7 replies

Brian Turcotte
Forum|alt.badge.img+37

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


markpiana
Klaviyo Employee
Forum|alt.badge.img+4
  • Klaviyo Employee
  • 25 replies
  • July 12, 2023

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

 


Forum|alt.badge.img+2
  • Contributor IV
  • 8 replies
  • September 21, 2023
markpiana wrote:

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.


markpiana
Klaviyo Employee
Forum|alt.badge.img+4
  • Klaviyo Employee
  • 25 replies
  • September 21, 2023

@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


Forum|alt.badge.img+2
  • Contributor IV
  • 8 replies
  • September 22, 2023
markpiana wrote:

@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.


brad.walker
Contributor I
Forum|alt.badge.img
  • Contributor I
  • 1 reply
  • December 6, 2023

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?


Forum|alt.badge.img+2
  • Contributor IV
  • 8 replies
  • December 6, 2023
brad.walker wrote:

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).