- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  NSString *tokenString;
  if (@available(iOS 13.0, *)) {
    NSUInteger dataLength = deviceToken.length;
    if (dataLength == 0) {
      return;
    }

    const unsigned char *dataBuffer = deviceToken.bytes;
    NSMutableString *hexString  = [NSMutableString stringWithCapacity:(dataLength * 2)];
    for (int i = 0; i < dataLength; ++i) {
      [hexString appendFormat:@"%02x", dataBuffer[i]];
    }
    tokenString = [hexString copy];
  } else {
    tokenString = [NSString stringWithFormat:@"%@", deviceToken];
  }
  [[Appboy sharedInstance] registerPushToken:tokenString];
}