Question from a developer:
I'm calling a Cloud Script that returns a pretty complex JSON object. I'm using the Cocos2d-x SDK, and I'm getting back a MultipletypeError response. What causes this?
Question from a developer:
I'm calling a Cloud Script that returns a pretty complex JSON object. I'm using the Cocos2d-x SDK, and I'm getting back a MultipletypeError response. What causes this?
This is due to an old concept that we've since replaced in most SDKs - the MultiTypeVar. This was designed as a generic way to handle complex objects, but simply put, it never completely solved that case. The way to solve this is to just change your return to be a string. So instead of
return theBigObject;
go with this:
return JSON.stringify(theBigObject);
Then, you would use RapidJSON (part of Cocos2d-x) to deserialize the string and get your object.
1 Person is following this question.