Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APN Push Notifications in Twilio IP Messaging

I'm trying to get push notifications on an app that's using Twilio IP Messaging. After following the instructions that I can see here: https://www.twilio.com/docs/api/ip-messaging/guides/push-notifications-ios

I'm drawing blanks.

The AppDelegate functions to register for remote notifications is working well - the iOS devices successfully provides the device token to the Twilio Client. However, the TwilioIPMessagingClient gives no indication of success or failure while registering the token. Moreover, I don't get any sign of push notifications when messages get sent. I'm not sure how to debug this any further since Twilio is a black box for APNS pushes.

Is there a logging service inside IPM/another debugging method I can access to see the status of APN pushes?

like image 433
sparkFinder Avatar asked Mar 16 '16 05:03

sparkFinder


2 Answers

I'm a developer on the IP Messaging team at Twilio and can hopefully provide some additional information here.

Registration feedback from the IP Messaging SDK is currently limited to failures, which you'll receive via the delegate method -ipMessagingClient:toastRegistrationFailedWithError:

That being said, upon calling registerWithToken: on your instance of the TwilioIPMessagingClient, you should see log entries that show the registration is being sent to our server:

TNNotificationClient | Starting registration..., id: <....> TNRegTransport | Creating registration: apn - <....> TNRegTransport | Registration is created, location: https://ers.us1.twilio.com/v1/registrations/<...>

When a message is sent to a channel, push registrations for members of that channel are queried and push messages sent to any registered members. Twilio uses the device token you provide for a given user via the registerWithToken: method and the credential SID (starting with CR) you provided in the JWT the client was created with that created that registration. The credentials you provide to Twilio via the REST or web interface must match up to the registration performed on the device both in AppID as well as environment (sandbox versus production).

A few things to verify:

  • Ensure you have created a credential SID and it appears here: https://www.twilio.com/user/account/ip-messaging/credentials
  • Ensure when you created the credential, you indicated whether it was for the APNS sandbox (development provisioning profile) or production (ad-hoc, enterprise or app store) certificate
  • Ensure that the JWT you are generating has a credential_sid grant and it matches the CR and environment you are running the app in during push registration

If you would like, I'd be happy to help you diagnose this further with your specific account details if you open a ticket at https://www.twilio.com/help/contact and reference this post. We'll be sure to update this SO post with any additional public information that arises from that conversation.

Randy

like image 101
rbeiter Avatar answered Sep 27 '22 22:09

rbeiter


I found the Twilio Debugging console to be useful diagnosing push notification issues. I only found out about it after I got an email with an error message saying my APNS token was invalid. That was after spending a while trying to diagnose the issue.

You can find the console here: https://twilio.com/console/dev-tools/debugger

like image 35
James Mundy Avatar answered Sep 27 '22 22:09

James Mundy