Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

"Received data was not a string, or was not a recognised encoding." #28

Open
adamrainsby opened this issue Mar 9, 2016 · 17 comments
Open

Comments

@adamrainsby
Copy link

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
    );
@miro
Copy link

miro commented Mar 17, 2016

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.

@CodeTitanian
Copy link

+1

3 similar comments
@vkshrestha
Copy link

+1

@mofelee
Copy link

mofelee commented Apr 25, 2016

+1

@kevinhylant
Copy link

+1

@kevinhylant
Copy link

kevinhylant commented May 13, 2016

@lwansbrough Any update on this issue or is this something that is a bug with the RN core code?

@lwansbrough
Copy link
Collaborator

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?

@kevinhylant
Copy link

kevinhylant commented May 14, 2016

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!

@adeelraza
Copy link

@lwansbrough still getting this warning on RN 26

@kevinhylant
Copy link

@adeelraza @lwansbrough - I can confirm the same.

@lwansbrough
Copy link
Collaborator

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.

@Alons-Oh
Copy link

Alons-Oh commented Jun 7, 2016

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.

@lwansbrough
Copy link
Collaborator

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.

@xiaolv899
Copy link

+1

1 similar comment
@oportocala
Copy link

+1

@lwansbrough
Copy link
Collaborator

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.

@peacechen
Copy link

peacechen commented May 31, 2018

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.

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

No branches or pull requests