简体   繁体   English

通知 iOS 13+ 和 JavaPNS - 无效的令牌

[英]Notification iOS 13+ and JavaPNS - Invalid token

I use JavaPNS (2.2) for send notification.我使用 JavaPNS (2.2) 发送通知。 Now, with iOS 13.x, i have a problem.现在,使用 iOS 13.x,我遇到了问题。

This is my (new) code for register the device to server:这是我将设备注册到服务器的(新)代码:

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    
    NSString *tokenNotification = nil;
    NSUInteger length = deviceToken.length;
    if(length > 0) {
        const unsigned char *buffer = deviceToken.bytes;
        NSMutableString *hexString = [NSMutableString stringWithCapacity:(length * 2)];
        for(int i=0; i<length; ++i) {
            [hexString appendFormat:@"%02x", buffer[i]];
        }
        
        tokenNotification = hexString;
    }

...
...
...

}

tokenNotification has same value of deviceToken.debugDescription . tokenNotification具有相同的价值deviceToken.debugDescription

When I try to send notification using JavaPNS, returns an error: " Invalid token ".当我尝试使用 JavaPNS 发送通知时,返回错误:“无效令牌”。 I have this problem only on iOS 13+.我只在 iOS 13+ 上有这个问题。 My device has iOS 13.7.我的设备有 iOS 13.7。 With iOS up to 12, using deviceToken as value of registration (without "<" and spaces), works fine.对于 iOS 高达 12,使用deviceToken作为注册值(没有“<”和空格),工作正常。

Can you help me?你能帮助我吗?

Ok, solved!好的,解决了! It was just a certificate issue.这只是一个证书问题。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM