1

I'm trying to do login using UIWebView. On success it stores cookie in NSHTTPCookieStorage. It's working fine for a single session.

But if I force close the app and come back to app, it ask me for login. Whereas it's cookie is already stored.

Also I referred this link https://stackoverflow.com/a/8713316/2594560. But my sessionOnly:FALSE and expiration date is also set.

Below is code:

override func viewDidLoad() {
    super.viewDidLoad()

    let request = NSURLRequest(URL: NSURL(string: "https:serverURL/show_all")!)
    webView.loadRequest(request)
}

If user is not login then this will redirect to login page, but if user is login then it should display this "show_all" page. It works with the cookie. But if I force close app and restart app, then it's redirecting to login.

Please guide me how to achieve this.

Community
  • 1
  • 1
Ankita Shah
  • 2,178
  • 3
  • 25
  • 42

0 Answers0