1

I am setting uiWebviewSocial as desired on IB and is loading requests as normal. However, later I need also to init this uiwebview in order to clear goBack history. I am using another uiwebview object for this purpose, webViewBridge

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.webviewBridge = [[UIWebView alloc] init];
    self.webviewBridge = self.webViewSocial;

when I need to init UIWebViewSocial, I use following

    self.webViewSocial = nil;
    self.webViewSocial = [[UIWebView alloc] init];
    self.webViewSocial = self.webviewBridge;

however, if I then make goBack action, uiwebview loads an old request when should have its history empty. What I am missing? thank you

Jaume
  • 3,672
  • 19
  • 60
  • 119
  • What are you trying to do allocating a UIWebView, then replace it with the other existing web view? Of course the old one will stay. – nhahtdh Jun 09 '12 at 17:27
  • true, because I need the old one! when viewdidload webviewsocial has no history. So I am trying to set webviewsocial as webviewbridge (=webviewsocial with no history) – Jaume Jun 09 '12 at 18:02

3 Answers3

3

Well, I've been going aroundUIWebView in Stack Overflow these days and is a mess, for me at least.

It seemsUIWebView cache works at its own, I mean we cannot change neither access some info that is exclusively managed by system...

About your problem, it seems although yourUIWebView is sent to nil, it keeps getting info from cache... so, you should clear cache firstable You can check it here and there

Community
  • 1
  • 1
isolMAC
  • 126
  • 3
0

The problem is that after you are init'ing the new webviewBridge or webviewSocial, you are immediately overwriting the new object with the assignment on the next line. Remove the third line in each method.

Andy Obusek
  • 12,614
  • 4
  • 41
  • 62
  • yes, but I need to overwrite it! when viewdidload, webviewsocial has no history. So I am trying to set webviewsocial as webviewbridge (=webviewsocial with no history) – Jaume Jun 09 '12 at 18:03
  • I'm confused, it originally sounded like you wanted to clear history, but now you are saying you are tryin to keep history? Which is it? – Andy Obusek Jun 09 '12 at 21:45
  • I want to clear history, that's it! when I said that I want to keep history?? If more information is required or not clear please ask. Thanks – Jaume Jun 10 '12 at 12:05
0

If I am not misunderstanding, when you load the view you get an "initial" webviewSocial (with history and contents??), then after some loadings you make in the UIWebView, these are stored as history in webviewBridge, isn't it? When you send webviewSocial to nil, that shall be empty... but NOT webviewBridge... and then if you are reloading webviewSocial with webviewBridge (which in fact is previous whole history), that's why it happens... I think

Saludos

isolMAC
  • 126
  • 3
  • No, first, on init, webViewBridge = webViewSocial without history. Then after some loadings, webViewSocial will have history filled. Then, when webViewSocial = webViewBridge, history should be clean! – Jaume Jun 10 '12 at 11:22