0

I have an application what is a web wrapper.

I need to display a login page from the server into UIWebView always when application become active. I tried in many ways but always if the user is logged second page is displayed and not login page(i don't have access to source page from server). UIWebView is made in storyboard and only from code I load the request

[[NSURLCache sharedURLCache] removeAllCachedResponses];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
NSURL *url = [NSURL URLWithString:stringWithUrl];
NSURLRequest *request = [NSURLRequest requestWithURL:url
                                             cachePolicy:NSURLRequestReloadIgnoringCacheData
                                         timeoutInterval:20.0];
[self.viewWeb loadRequest:request];

Also I register the class for notification when application enter in background to destroy webview

    [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(resetInterfaceForCaseWhenApplicationBecomeInactive)
                                             name:UIApplicationDidEnterBackgroundNotification
                                           object:nil];

And in method what is trigger by notification

  self.viewWeb.delegate = nil;
  self.viewWeb = nil;

I don't know what can do more to solve this. Any suggestion?

geonl
  • 39
  • 4

1 Answers1

0

This problem related to cookies that web server puts to authenticated users, removing them should fix the issue. I added link to solution in comment before.

sage444
  • 5,661
  • 4
  • 33
  • 60