Home > Uncategorized > Push Notifications #iOS13 with Cordova PushPlugin

Push Notifications #iOS13 with Cordova PushPlugin


If you’re using phonegap-plugin-push 1.10.0 “PushPlugin” with Cordova and iOS13, then you will quickly notice, that in your callback, that the data.registrationId will be in the wrong format, something like:


as the device token, which will obviously not work.

So, there are solutions, like upgrading the push plugin, but for whatever reason, you can’t do that, here is the code change necessary to fix the plugin:

Open Plugins > PushPlugin.m

Scroll down to didRegisterForRemoteNotificationsWithDeviceToken

and remove this line of code:

    NSString *token = [[[[deviceToken description] stringByReplacingOccurrencesOfString:@”<“withString:@””]

stringByReplacingOccurrencesOfString:@”>” withString:@””]

stringByReplacingOccurrencesOfString: @” ” withString: @””];

and replace this with:

NSUInteger length = deviceToken.length;

const unsigned char *buffer = deviceToken.bytes;

NSMutableString *hexString= [NSMutableString stringWithCapacity:(length * 2)];

for (int i = 0; i < length; ++i) {

[hexString appendFormat:@”%02x”, buffer[i]];


NSString *token = [hexString copy];

This is from https://onesignal.com/blog/ios-13-introduces-4-breaking-changes-to-notifications/ – So credit due, and respect to George Deglin for this fix.

With this fix, the registrationId goes back to normal, and push notifications work as before.


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: