Notification iOS 13+ and JavaPNS - Invalid token

93 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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