Closed wilhelmberg closed 7 years ago
hmm!
Getting 401 Unauthorized
using WWW
:
The URL works in the browser and with UnityWebRequest
.
I spent 5 minutes converting UnityWebRequest
into WWW
last night and saw errors on iOS, as well. It seemed to work in the editor, though.
Rather than replacing UnityWebRequest, I think we should make a different concrete version of IFileSource
that uses WWW
. There may be a fix for all this in the near future (being hopeful here).
The other thing to look out for with WWW is making it cancelable. I'm very surprised there isn't more discussion about this on the internet, given how much this affects so many developers . . .
Oops, my bad I added the access_token
to the request url twice.
It does work with WWW
.
The other thing to look out for with WWW is making it cancelable. I'm very surprised there isn't more discussion about this on the internet, given how much this affects so many developers . . .
Yes, noticed that too - that's not good. Luckily we don't transfer a lot of data per request.
If you throw this on a branch today, I can test on iOS. 😄
Working branch is here: https://github.com/mapbox/mapbox-sdk-unity-core/tree/optimize-http-requests
It's not yet completely usable, but that's the HTTPRequest.cs using WWW
.
Maybe you could just replace the file? Should be a drop-in replacement.
EDIT --> updated Response.cs is also needed as I added the response headers <-- EDIT.
FWIW, this should not be a replacement, but an additional option.
refs #11
background: https://github.com/mapbox/mapbox-go/issues/28
https://docs.unity3d.com/ScriptReference/WWW.html