我正在使用适用于 iOS 的 Twilio Voice Objective-C 快速入门。我可以在创建访问令牌后注册 TwilioVoice,如下所述:-
#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 for VoIP push notifications.");
}
}];
}];
}
}
根据 Pushkit ( PKPushRegistry ) 方法,我已经创建了 5 分钟的令牌
- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type
应该在令牌过期后调用。但是didInvalidatePushTokenForType没有调用,试了很多次。
如何检查当前访问令牌是否过期,传入' registerWithAccessToken ”传递?
当前访问令牌过期后,我想使用 AccessToken 重新注册 TwilioVoice。
请帮助,提前谢谢。