So the problem I am having is that I’m using RestKit to to authenticate a self signed certificate and deal with user login simultaneously but after the webView opens then that first page is not being added to the backForward list (as far as i can tell). i.e. after i click on a link on that page I cannot go back to the previous page. If I click on another link (3 pages in) i can go back to the second page but still not the first.. Is there a way to manually add the URL to the backForward list when I open the UI Webview? Or any suggestions for other work-arounds?
- (id)initWithURL:(NSURL*)pageURL {
_retainedURL = pageURL;
[_retainedURL retain];
RKClient *client;
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
client = [RKClient clientWithBaseURL: pageURL];
client.username=[userDefaults objectForKey:@"UserName"];
client.password=[userDefaults objectForKey:@"Password"];
client.authenticationType=RKRequestAuthenticationTypeHTTPBasic;
client.disableCertificateValidation= TRUE;
//The below "delegate:self seems to be what is preventing the URL from passing into the forwardBack list (works if it is delegate self but then RestKit breaks
RKRequest *request=[RKRequest requestWithURL:pageURL delegate:self];
[client configureRequest:request];
request.authenticationType = RKRequestAuthenticationTypeHTTPBasic;
request.disableCertificateValidation = TRUE;
self.authenticatedRequest = request;
NSLog(@"%@",[request URLRequest]);
[request sendAsynchronously];
if(self = [super init]) {
self.URL = pageURL;
self.availableActions = SVWebViewControllerAvailableActionsOpenInSafari | SVWebViewControllerAvailableActionsMailLink | SVWebViewControllerAvailableActionsCopyLink;
}
return self;
}
I ended up fixing this error by creating an NSMutableArray array to keep track of the browser history and adding code to handle various things such as the forward and back buttons display. I’m using 2 ints (urlListIndex and urlIndexMax) as well as a BOOL (backFix) for navigation control