我使用Twilio语音Objective-C的快速启动适用于iOS。 我能够下文提到创建访问令牌后注册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.");
}
}];
}];
}
}
我已经创建令牌5分钟,按照Pushkit(PKPushRegistry)方法
- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type
应该叫令牌过期后。 但didInvalidatePushTokenForType不打电话,试了很多次。
我怎么能检查当前访问令牌过期与否,“registerWithAccessToken”通过呢?
我想重新注册TwilioVoice用的accessToken后当前访问令牌过期。
请帮帮忙,在此先感谢。