ios - Method didInvalidatePushTokenForType is not calling on token expired using Twilio -
i using twilio voice objective-c quickstart ios. able register twiliovoice after creating access token mentioned below:-
#pragma mark - pkpushregistrydelegate - (void)pushregistry:(pkpushregistry *)registry didupdatepushcredentials:(pkpushcredentials *)credentials fortype:(nsstring *)type { nslog(@"pushregistry:didupdatepushcredentials:fortype:"); if ([type isequaltostring:pkpushtypevoip]) { self.devicetokenstring = [credentials.token description]; [[phonecallmodel sharedinstanse] getaccesstokenresponse:^(nsstring *accesstoken) { [[twiliovoice sharedinstance] registerwithaccesstoken:accesstoken devicetoken:self.devicetokenstring completion:^(nserror *error) { if (error) { nslog(@"an error occurred while registering: %@", [error localizeddescription]); } else { nslog(@"successfully registered voip push notifications."); } }]; }]; } } i have created token 5 mins, per pushkit (pkpushregistry) method
- (void)pushregistry:(pkpushregistry *)registry didinvalidatepushtokenfortype:(pkpushtype)type should call after token expired. didinvalidatepushtokenfortype not calling, tried many times.
how can check current access token expired or not, passed in 'registerwithaccesstoken'?
i want re-register twiliovoice accesstoken after current access token expired.
please help, in advance.
twilio developer evangelist here.
wanted complete circle here, this question asked , may have follow on github project quickstart application. here's answer bobie works on programmable voice sdk team:
the - (void)pushregistry:(pkpushregistry *)registry didinvalidatepushtokenfortype:(pkpushtype)type delegate method called when device token issued apple voip service has expired or no longer valid use. more details in documentation apple.
the main idea of using access token provide "one-time" operation authentication, registration requests or signaling handshake when making outgoing calls. being said, still recommend generate access tokens expiry equal or longer 1 hour when making outgoing calls.
as refreshing registry, don't have re-register unless have explicitly unregistered (or pushkit token has expired). application still able receive push notifications twilio.
just add this, if want automatic access token management in application, can use twilio accessmanager sdk. common sdk shared among programmable voice, chat, video , sync. there instructions installing in chat documentation.
this page shows how use accessmanager chat sdk. can substitute programmable voice sdk , should work same though.
let me know if helps @ all.
Comments
Post a Comment