For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HUMAN DashboardHUMAN WebsiteRequest a Demo
Product GuidesEnforcer GuidesMobile SDKAPI ReferenceCustomer support
Product GuidesEnforcer GuidesMobile SDKAPI ReferenceCustomer support
    • Overview
  • Mobile SDK (for Android, iOS, and visionOS)
    • Android changelog
    • iOS, iPadOs, & visionOS changelog
    • Expo changelog
    • React Native Wrapper changelog
  • iOS SDK
    • What's New
      • How to integrate the SDK in your application
      • How to verify the integration in your app with the SDK
      • Manual integration
      • Handle block responses from the server
      • How to retry requests that were blocked
      • Hybrid App support
      • Enable support for Account Defender
      • Multiple AppIDs support
      • Integration with React Native
      • Integration with Flutter
      • Integration with Ionic
      • Integration with gRPC
      • Migrating SDK from v2 to v3
    • How to test your app with the SDK
  • Android SDK
    • What's New
    • How to test your app with the SDK
LogoLogo
Login
Login
HUMAN DashboardHUMAN WebsiteRequest a Demo
On this page
  • v3.0
  • How to disable the URL request’s timeout
iOS SDKv3

How to retry requests that were blocked

Was this page helpful?
Previous

Hybrid App support

Next
Built with

v3.0

What is the Automatic Interceptor?

The “Automatic Interceptor” is a feature that allows the SDK to intercept URL requests from your app. Enabling this will reduce the amount of code you will have to write as part of the SDK integration.

URL Requests that were blocked by HUMAN don’t reach your server. Therefore, after the user solves the challenge you may want to retry those requests. You can configure the behavior of the SDK when requests are blocked:

  1. Delay response until challenge is solved or cancelled - setting this in the policy will delay the error response to your request’s handler until the user solves or cancels the challenge. Then, the error you will receive contains the information regarding the challenge result (solved or cancelled).
1policy.urlRequestInterceptionType = .interceptWithDelayedResponse
  1. Intercept and retry request - setting this in the policy will delay the error response to your request’s handler until the user solves or cancels the challenge. In addition, when the challenge is solved, the SDK will send the original request one more time. Your request’s handler should receive the response from your server without knowing that the request was blocked and sent again. You should note that when the challenge is cancelled or when the second request is also blocked, then the behavior will be the same as the “delay the response until the challenge is solved or cancelled” configuration.

Retry request on URLSession.shared

When the SDK retries the original request, it will use the URLSession.shared. Take this in consideration if you are using a custom URL Session object in your project.

1policy.urlRequestInterceptionType = .interceptAndRetryRequest

Disable the request's timeout

In order to delay the request’s response to your handler until the user interacts with the challenge, you must disable the request’s timeout. Otherwise, your handler will receive a timeout error and you might not know that your request was blocked nor the challenge was solved/cancelled.

How to disable the URL request’s timeout

URLSession:

1var urlRequest = URLRequest()
2urlRequest.timeoutInterval = 0

Alamofire:

1AF.request("<url>", headers: HTTPHeaders(headers)) { $0.timeoutInterval = 0 }