1

I'm getting the following when trying to make a Call to a firebase Database Exclusively on IOS I dont get the error on android builds.

    StatusCode  HttpVersionNotSupported 
    or
        ResponseData    "<html>\r\n<head><title>505 HTTP Version Not Supported</title></head>\r\n<body>\r\n<center><h1>505 HTTP Version Not Supported</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"     

Heres the Code im running:

return (await firebase
                .Child(ChildName)
                .OnceAsync<Userlogin>()).Select(item =>
                new Userlogin
                {

                    user_login = item.Object.user_login,
                    passwords = item.Object.passwords
                }).ToList();

Here is my Request URL:

    public FirebaseClient firebase = new FirebaseClient("https://myappname.firebaseio.com/");

The server is telling me that it does not accept the request because its either coming from Http or the version of http is out of date.

How do I either:

-Update the HTTP

-Force Https

On the IOS side of Xamarin Forms

Stack Trace to help a bit:

    StackTrace  "  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x0001b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpResponseMessage.cs:168 \n  at Firebase.Databa  at Firebase.Database.Http.HttpClientExtensions.GetObjectCollectionAsync[T] (System.Net.Http.HttpClient client, System.String requestUri, Newtonsoft.Json.JsonSerializerSettings jsonSerializerSettings) [0x00134] in <d27c522a7ecc437a9802ee0b4650ca23>:0 " 

I also want to add that my plist.file also has a https as the url request

Edit:

Issue is moved to: How to deserialize firebase fetch

The issue was Http setting in project, the lingering issue is a deserialisation issue. Will be closing this soon.

  • If the problem is the deserialisation process, the error message shouldn't be HttpVersionNotSupported. But you can also try to update the newtonsoft.json version, in addition, you can try to access the other websites to check if the httpclient version is enable or not. – Liyun Zhang - MSFT Jul 21 '22 at 08:49
  • @LiyunZhang-MSFT forgot to update here but I ended up changing the Http client in the project settings and started getting serialisation issues I moved the issue to: https://stackoverflow.com/questions/73062297/how-to-deserialize-firebase-fetch as the errors iw as getting was along the lines of: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary`2[System.String,Newtonsoft.Json.Linq.JObject]' because the type requires a JSON object – OnceUponATime Jul 21 '22 at 08:56
  • Did you get the same error when you tried the `List datalist = JsonConvert.DeserializeObject>(x);` – Liyun Zhang - MSFT Jul 21 '22 at 09:05
  • So I tried something like: `var x = (await firebase .Child(ChildName) .OnceAsync()).ToString(); var data = JsonConvert.DeserializeObject>>(x); List list = data.First().Value; ` But it leads to the same issue : because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. – OnceUponATime Jul 21 '22 at 09:17
  • @LiyunZhang-MSFT Resposne data is a bit weird tho: "[{\"passwords\":\"xxxxxx\",\"user_login\":\"xxxx\"},{\"passwords\":\"xxxx\",\"user_login\":\"xxxx\"} – OnceUponATime Jul 21 '22 at 09:17
  • Why are there many '\'? You can check [this case](https://stackoverflow.com/questions/22557559/cannot-deserialize-the-json-array-e-g-1-2-3-into-type-because-type-requ). – Liyun Zhang - MSFT Jul 21 '22 at 09:22
  • @LiyunZhang-MSFT I have no idea, I read up about it and apparently if you Regex or Desorlize it again it removes it, But that doesnt work for me it actually just loops the application into a death spiral and it crashes. Also I found that example im not sure how to pass my serialized string because if I pass it the way I am now I get the same error with all those examples if I Just give the Url I get a error about the posistion of 0: 0 is wrong or something like that – OnceUponATime Jul 21 '22 at 09:25

0 Answers0