I'm trying to deserialize response data from POST query. But my proto deserializer returns error:
'InvalidProtocolBuffer', reason: 'Invalid Tag: last tag 76'
Here is response string from rest client:
"EJMDGhnQlNC+0YHRgtGD0L8g0LfQsNC60YDRi9GC"
and here how i'm creating data from this string:
let data = dataString.dataUsingEncoding(NSUTF8StringEncoding);
And parse it:
var _deData = MobileGetNewsResponse.parseFromData(jsonData!)
Any suggestions to resolve this problem?
This data is not, itself, a protobuf. It appears that it may be a base64-encoded protobuf. You need to base64-decode it first, then pass it to the protobuf parser.
Keep in mind that protobufs are raw bytes, not text. You should never attempt to store a raw protobuf in a string, nor attempt to interpret it as Unicode or UTF-8. It's just bytes. (base64 is one way of turning bytes into text.)
I'm also concerned about this line:
JSON and Protobufs are two completely different formats. You should not be attempting to parse a protobuf as JSON nor vice versa.