场景11:推送接入
更新时间:2025-04-25 01:49:13

通话状态说明

设置APNS推送token

- (void)setApnsToken:(NSString * _Nonnull)token
  • PARAMETERS:
NAME NOTERIPTION
token 获取的token
token 从系统接口获取
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    NSLog(@"token:%@", deviceToken);
    if (![deviceToken isKindOfClass:[NSData class]]) return;
    const unsigned *tokenBytes = [deviceToken bytes];
    NSString *hexToken = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
                          ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
                          ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
                          ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];
    NSLog(@"deviceToken:%@",hexToken);

    /// set APNS token
    [[YealinkSDK shared] setApnsToken:hexToken];
}
本页目录