Checking for connectivity impossible in background URLSession?

To check for connectivity we should either:

  1. Set waitsForConnectivity = true and then monitor taskIsWaitingForConnectivity, or
  2. Set waitsForConnectivity = false and then fail immediately

However background sessions always wait for connectivity AND never call taskIsWaitingForConnectivity.

Huh?

In our case, at the time user is initiating downloads the "background" session is actually in the foreground and we need this information. What am I missing?

However background sessions always wait for connectivity

Yes.

AND never call taskIsWaitingForConnectivity.

Yes.

I think you could reasonably argue that a background session should call urlSession(_:taskIsWaitingForConnectivity:) when the app is in the foreground. If you want to make a case for that, I encourage you to file a bug about it. Please post your bug number, just for the record.

we need this information.

What do you plan to do with it?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Filed bug FB13079231

Checking for connectivity impossible in background URLSession?
 
 
Q