美文网首页
iOS推送获取token

iOS推送获取token

作者: 晴朗Nic | 来源:发表于2020-08-21 16:42 被阅读0次
    if (![deviceToken isKindOfClass:[NSData class]]) return;
        const unsigned *tokenBytes = (const unsigned *)[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);
    
    

    相关文章

      网友评论

          本文标题:iOS推送获取token

          本文链接:https://www.haomeiwen.com/subject/eptpjktx.html