I'm trying to request some data from an API using HttpClient in DidReceiveNotificationRequest method (Xamarin iOS Notification Service Extensions project).
When the GetAsync (HttpClient) the extension just crashes.
Am I doing something wrong?
public override async void DidReceiveNotificationRequest(UNNotificationRequest request, Action<UNNotificationContent> contentHandler)
{
...
using (HttpClient client = new HttpClient())
{
await client.GetAsync("https://google.com").ConfigureAwait(false); // crashes here
}
...
}
I also tried to use a NSUrlSessionHandler as the HttpClient handler, but no success.
try use with Uri:
and for iOS need add to .plist - NSLocalNetworkUsageDescription
maybe need add HttpMessageHandler: