PoloGV
PoloGV

Reputation: 101

iOS - How to detect a session timeout on UIWebView

I have a UIWebView displaying a website that has a timeout policy (idle for 1800 seconds). Since I use a custom login view to connect to the site, I want to call this same custom view after the website has issued the timeout alert.

How can I detect that such an alert has been issued to the webview, so I can call my code from there?

Thank you for your help.

Upvotes: 1

Views: 2949

Answers (2)

Anomie
Anomie

Reputation: 94804

If the website redirects to a particular page on timeout, you could watch for that page to be loaded in your UIWebViewDelegate's webView:shouldStartLoadWithRequest:navigationType: method.

Upvotes: 1

Luke Mcneice
Luke Mcneice

Reputation: 2720

Don't know how to solve this from UIKit perspective but if your session time out is known you could create an NSTimer in one of your controllers to alert you when a defined elapsed time, resetting it each time the app calls your site.

Upvotes: 0

Related Questions