"Received data was not a string, or was not a recognised encoding."
adamrainsby opened this issue · 17 comments
It seems to be getting picked up by google analytics but I'm getting this warning. Any idea why?
I'm running ios version 9.2 and this is how I'm calling it.
let screenView = new GAHits.ScreenView(
config.app.name,
screenName,
config.app.version,
config.app.id,
null,
null
);
Same here. But it seems that this appears only when running my application via the iOS simulator; when testing with iPhone, the warning doesn't pop up.
+1
+1
+1
+1
@lwansbrough Any update on this issue or is this something that is a bug with the RN core code?
I think a recent version of React Native may have addressed the problem of receiving generic data from XHR requests. Is anyone still getting this warning with React Native 0.25?
We're running RN at 0.23 right now, will try updating to see if it is resolved & let you know soon as I have - thanks!
@lwansbrough still getting this warning on RN 26
@adeelraza @lwansbrough - I can confirm the same.
The other option is to use Image.prefetch instead of XHR but that's kind of an abuse of ram. Though 1x1 images are really small.
Hi I'm getting this issue too, I don't know if this is preventing my GA to collect the data, or if the error just happens on my app and the GA should gather the info properly (which is not happening), I don't even know if this is the right place to ask for help on this XD I'm running RN 0.23, I'm trying on the iOS emulator and on my android device.
EDIT: Actually I found out GA is actually gathering the info properly, so the issue is only on the app.
We're using this library in production in several apps without a problem. The only issue is the warning in dev mode. If anyone wants to try and sub the fetch call with Image.prefetch that would be helpful.
+1
+1
Guys please stop +1ing this, GitHub has reactions now if you wish to indicate your interest/support. Beyond that, this issue is a problem with React Native itself. I'm tempted to close this as wontfix but I think there might be a better solution than that.
Substituting Image.prefetch
for fetch
isn't ideal because that can flush out actual useful images from the image cache.
How about using the underlying XMLHttpRequest?
In Analytics.js, replace fetch with:
return new Promise(function (resolve, reject) {
let xhr = new XMLHttpRequest();
xhr.open('GET', request);
xhr.setRequestHeader('User-Agent', this.userAgent);
xhr.onload = resolve;
xhr.onerror = reject;
xhr.send();
});
Scratch that. Still getting the yellow box warnings with XMLHttpRequest. Looks like this needs to be fixed in RN itself.