Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to use HttpClient cross platform?

$
0
0

I don't give up on this issue. How can I use HttpClient across Android, iOS and Desktop (basically MS Unit Testing)? I created a PCL that targets .NET 4.5, Android and iOS. SL5 gets added automatically by Visual Studio. In order to use HttpClient I install the Nuget package Micrsoft.Net.Http. On Android I reference System.Net.Http.

In the PCL I have:

Client = messageHandler == null ? new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }) : new HttpClient(messageHandler);

The result is: - I cannot debug into the PCL - I get a runtime exception that _setAutomaticDecompression is unknown (even though it should use the call where a message handler gets passed - new OkHttpNetworkHandler() from ModernHttpClient package!)

Is there a way to get things right or do I have to change my whole project to file linking (around 100 files!!)?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>