Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNJSONSerialization replacing NSNull characters during serialization prevents proper deserialization #87

Open
AdamPro13 opened this issue Apr 17, 2015 · 1 comment

Comments

@AdamPro13
Copy link

I've been having an issue when I try to send a PNMessage with a message that contains an NSNull value.

I see when I try to send a PNMessage, you're serializing the message using the method PNJSONSerialization +stringFromJSONObject:. This method serializes the object, then starting on line 196 you have

// Replace null value has been passed or not (serialized [NSNull null] value)
if ([JSONString respondsToSelector:@selector(stringByReplacingOccurrencesOfString:withString:)]) {

    JSONString = [JSONString stringByReplacingOccurrencesOfString:@":null" withString:@":\"null\""];
}

The problem with this is it's preventing me from properly deserializing the message that is returned in by the PNDelegate method pubNubClient:didReceiveMessage:. Those original NSNull objects are being deserialized to NSStrings with value null.

I tried removing those lines of code and the message is sending and being received as expected now.

@parfeon
Copy link
Contributor

parfeon commented Apr 24, 2015

Hi @AdamPro13

This is not really solution for your issue. Changes should be done on corresponding step - deserialisation. We will include proper fix in future release.

Best regards,
Sergey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants