OneSignal/OneSignal-Xamarin-SDK

[Bug]: iOS - Using DeleteTags to remove multiple tags fails with a json validation error

matthewrdev opened this issue · 3 comments

What happened?

On iOS, when using the OneSignal.Default.DeleteTags method, it fails with the following issue:

2023-03-22 10:44:02.065124+1000 REDACTED.iOS[8819:230185] WARNING: sendTags JSON Invalid: The following key/value pairs you attempted to send as tags are not valid JSON: {
    user = "";
    "<null>" = "";
}

The user and <null> tags are two tags not provided by my code through the DeleteTags method.

I can work around this by deleting each tag one-by-one, however this results in many more HTTP requests and takes much longer:


foreach (var tag in tags)
{
   await OneSignal.Default.DeleteTag(tag);
}

Steps to reproduce?

1. Add several tags to an account using the `SendTags` method. 
2. Delete these tags using `DeleteTags`.

Example:

var myTags = new string[] { "Alpha", "Beta", "Zeta" };
await OneSignal.Default.SendTags(tags)
await Task.Delay(10_000); // Simulate some work.
await OneSignal.Default.DeleteTags(myTags);


### What did you expect to happen?

I expect that calling `OneSignal.Default.DeleteTags` works and does not fail with a json error.

### OneSignal Xamarin SDK version

4.3.3

### Which platform(s) are affected?

- [X] iOS
- [ ] Android

### Relevant log output

```Shell
2023-03-22 10:44:02.065124+1000 REDACTED.iOS[8819:230185] WARNING: sendTags JSON Invalid: The following key/value pairs you attempted to send as tags are not valid JSON: {
    user = "";
    "<null>" = "";
}

Code of Conduct

  • I agree to follow this project's Code of Conduct

Hi @matthewrdev , I've confirmed this as a bug and hope to have a fix soon.

This has been released via v4.3.4

Thanks for the quick turnaround @brismithers!