简体   繁体   中英

Notification iOS 13+ and JavaPNS - Invalid token

I use JavaPNS (2.2) for send notification. Now, with iOS 13.x, i have a problem.

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 .

When I try to send notification using JavaPNS, returns an error: " Invalid token ". I have this problem only on iOS 13+. My device has iOS 13.7. With iOS up to 12, using deviceToken as value of registration (without "<" and spaces), works fine.

Can you help me?

Ok, solved! It was just a certificate issue. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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