App api request gives timeout and not internet connection

Hi Team,

I am reaching out to you because I've encountered an issue with iOS versions 16.3.1 and later.

Scenario:

We have implemented facial authentication for seamless auto-login into our application. Upon successful facial authentication, the application proceeds to make requests to our APIs. However, we are encountering timeout errors when the API requests are in progress and the app is moved to the background. Strangely, this issue emerged after upgrading to the latest release from a previously stable version (iOS 16.3).

Despite reviewing the release notes, we have not identified any pertinent information about new policy restrictions that might be causing this problem. We are actively seeking guidance on resolving this issue, aiming to restore the previously functional behavior of the application

Answered by pushpendra10 in 763139022

We are using NSURLSessionDataTask. I believe this is also going to behave in similar manner. If that is the case it should have been behaving in similar manner

But why it was working fine in iOS 16.3 and below it is not giving any time out issues

Upon successful facial authentication, the application proceeds to make requests to our APIs.

What Apple API are you using to make these requests?

Share and Enjoy

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

We are using NSMutableURLRequest

With NSURLSession, right?

NSURLSession supports standard and background sessions. If your use a standard session the work is done by your process. If your app moves to the background and then gets suspended, you’ll encounter weird problems. You have a bunch of options for dealing with that:

  • Cancel your requests when you move to the background.

  • Use a UIApplication background task to prevent your app being suspended while a request is in flight. See UIApplication Background Task Notes for more info on that API.

  • Switch to a background session.

The best option depends on the nature of your requests. For interactive work, like what you’re describing, I usually recommend one of the first two options. Background sessions work best with a small number of a large requests.

Share and Enjoy

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

Accepted Answer

We are using NSURLSessionDataTask. I believe this is also going to behave in similar manner. If that is the case it should have been behaving in similar manner

But why it was working fine in iOS 16.3 and below it is not giving any time out issues

We are using NSURLSessionDataTask.

Data tasks can be used in a background session, but with significant limitations [1]. Most folks using data task are using a standard session.

But why it was working fine in iOS 16.3

It’s hard to say without an in-depth analysis, and I’m not sure that’s warranted. The rules for standard sessions have always been that you must either:

  • Ensure that your app doesn’t get suspended while a request is in flight, or

  • Deal with the request failing with a wacky error if your app does get suspended.

Share and Enjoy

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

[1] Unlike upload and upload tasks, data tasks in a background session won’t keep running when your app is suspended, so they behave much like data tasks in a standard session.

App api request gives timeout and not internet connection
 
 
Q