Xamarin-macios: CFnetworkHandler does not support background sessions

Created on 24 Jan 2019  路  2Comments  路  Source: xamarin/xamarin-macios

The CFNetworkHanlder, which can be found here does not use kCFStreamNetworkServiceTypeBackground which means that does not support background sessions. This is an issue, because when an application goes into the background, the application will not perform the downloads.

This issue connects with https://github.com/xamarin/xamarin-macios/pull/5463. In that PR, we are canceling all those requests that are not performed in a background session to ensure that the thread pool from mono does not hang the application. This can be done because, if a developer has issues with the cancelation, we can state that he should be using a background session. The same cannot be said about the CFNetworkHandler, because, if we cancel the requests, we have not correct alternative to be given to the developer.

This issue will imply two different pieces of work

  1. Provide an API to create background "sessions" for the CFNetworkHandler.
  2. Perform a similar approach as the one done in https://github.com/xamarin/xamarin-macios/pull/5463

I'm creating the issue to start a discussion, because:

  1. CFNetwork is obsolete, do we want to put the effort?
  2. We are changing behaviour yet we have never had complains about the issue per se, so we might result in applications not executing as they used to.

I am personally inclined in not working on the issue. Have it here so that developers can find it, and if we have many requests, work on it.

@chamons @spouliot @rolfbjarne comments are welcome :)

enhancement iOS macOS

Most helpful comment

I think that since CFNetwork is obsolete, there's no need to implement any new behavior.

All 2 comments

I think that since CFNetwork is obsolete, there's no need to implement any new behavior.

I don't have much appetite to change CFNetwork for fear of breaking existing apps.

Leaving this open as long as CFNetwork is a supported option may be useful in case people run into this, we can point them here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whitneyschmidt picture whitneyschmidt  路  3Comments

michaelstonis picture michaelstonis  路  3Comments

parmjitv picture parmjitv  路  4Comments

orryverducci picture orryverducci  路  4Comments

rolfbjarne picture rolfbjarne  路  4Comments