[ObjCRuntime] Default to NSUrlSessionHandler for watchOS, since HttpClientHandler doesn't work. (#843)

This commit is contained in:
Rolf Bjarne Kvinge 2016-09-16 14:46:18 +02:00 коммит произвёл Sebastien Pouliot
Родитель 27424075eb
Коммит eb7c2fdb64
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -238,8 +238,13 @@ namespace XamCore.ObjCRuntime {
internal static HttpMessageHandler GetHttpMessageHandler ()
{
var options = RuntimeOptions.Read ();
if (options == null)
if (options == null) {
#if WATCH
return new NSUrlSessionHandler ();
#else
return new HttpClientHandler ();
#endif
}
// all types will be present as this is executed only when the linker is not enabled
var handler_name = options.http_message_handler;
@ -250,8 +255,13 @@ namespace XamCore.ObjCRuntime {
handler = Activator.CreateInstance (t) as HttpMessageHandler;
if (handler != null)
return handler;
#if WATCH
Console.WriteLine ("{0} is not a valid HttpMessageHandler, defaulting to NSUrlSessionHandler", handler_name);
return new NSUrlSessionHandler ();
#else
Console.WriteLine ("{0} is not a valid HttpMessageHandler, defaulting to System.Net.Http.HttpClientHandler", handler_name);
return new HttpClientHandler ();
#endif
}
#endif
#endif