代码之家  ›  专栏  ›  技术社区  ›  Asif Raza

didInvalidatePushTokenForType方法未使用Twilio调用过期的令牌

  •  1
  • Asif Raza  · 技术社区  · 7 年前

    我正在使用 适用于iOS的Twilio Voice Objective-C快速入门

    #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.");
                                                               }
                                                           }];
            }];
        }
    }
    

    PKPushRegistry )方法

    - (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type
    

    没有打电话,试了很多次。

    registerWithAccessToken

    1 回复  |  直到 7 年前
        1
  •  4
  •   Community Lee    4 年前

    Twilio开发者布道者。

    想在这里完成这个循环 this question was also asked and may have follow up on the GitHub project for the quickstart application

    当Apple VoIP服务先前发布的设备令牌已过期或不再有效时,调用-(void)pushRegistry:(PKPushRegistry*)registry didvalidatepushtokenfortype:(PKPushType)type委托方法。更多详细信息,请参阅Apple提供的本文档。

    使用接入令牌的主要思想是提供“一次性”操作认证,用于注册请求或发出呼出呼叫时的信令握手。也就是说,我们仍然建议您在拨出电话时生成到期时间等于或大于1小时的访问令牌。

    至于刷新注册表,实际上不需要重新注册,除非您已明确取消注册(或者PushKit令牌已过期)。应用程序仍然能够从Twilio接收推送通知。

    AccessManager SDK。这是可编程语音、聊天、视频和同步之间共享的通用SDK。有 instructions for installing it in the Chat documentation

    然后,此页面显示 how to use the AccessManager with the Chat SDK 。您可以替换可编程语音SDK,但它应该可以同样工作。