Hi,
I am getting response from sever and able to parse the data successfully when i run in ios simulator but when i run on android device app closes with msg “unfortunately app has stopped”
and here is the log of error i get -
(22798): Abort message: '/Users/mihir/Desktop/test/proj.android/../cocos2d/external/flatbuffers/../json/document.h:1681: const Ch* rapidjson::GenericValue<Encoding, Allocator>::GetString() const [with Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; rapidjson::GenericValue<Encoding, Allocator>::Ch = char]: assertion "IsString()" failed'
Here is my rapidjson parsing code -
if (response->isSucceed()) {
log("Get success");
std::vector<char>* buffer = response->getResponseData();
std::string res;
res.insert(res.begin(), buffer->begin(), buffer->end());
log("res: %s", res.c_str());
rapidjson::Document d;
d.Parse<0>(res.c_str());
if(d.IsObject()){
F = d["F"].GetString();
W = d["W"].GetString();
T = d["T"].GetString();
Fp = d["Fp"].GetString();
Wp = d["Wp"].GetString();
Tp = d["Tp"].GetString();
const rapidjson::Value& a = d["list"]; // Using a reference for consecutive access is handy and faster.
assert(a.IsArray());
for (rapidjson::SizeType i = 0; i < a.Size(); i++)
{
this->arr[i] = a[i].GetString();
}
}
Thank you…