In my application i am using Uiwebview for displaying vimeo authorization page, after the user has authorized it, i have to parse the url for OAtoken and dismiss it, for that i am using should startLoad delegate method, but after the process is over and when i am returning NO, the control is not transferred back...
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSURL *url = [request mainDocumentURL];
NSString *str1 = [url absoluteString];
NSString *str = @"https://vimeo.com/oauth/confirmed";
//[webView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_cork.png"]]];
if([str isEqualToString:str1])
{
//removing the webview after the user approves.
//[webView removeFromSuperview];
return YES;
}
//parsing the redirected url to get the oauth_verifier.
URLParser *parser = [[URLParser alloc] initWithURLString:str1];
Oauth_verifier = [parser valueForVariable:@"oauth_verifier"];
//getting the final access token by giving the oauth verifier.
NSURL *url_access = [[NSURL alloc] initWithString:@"https://vimeo.com/oauth/access_token"];
OAMutableURLRequest *reques_access = [[OAMutableURLRequest alloc]initWithURL:url_access consumer:consumer token:acessToken realm:nil signatureProvider:nil];
OARequestParameter *p2 = [[OARequestParameter alloc] initWithName:@"oauth_verifier" value:Oauth_verifier];
NSArray *params2 = [NSArray arrayWithObject:p2];
[reques_access setParameters:params2];
[reques_access setHTTPMethod:@"GET"];
OADataFetcher *fetcher_access = [[OADataFetcher alloc]init];
[fetcher_access fetchDataWithRequest:reques_access delegate:self didFinishSelector:@selector(acessTokenTicket:didFinishWithData:) didFailSelector:@selector(acessTokenTicket:didFailWithError:)];
//if the access token is successfully generated then the control transferrd to acessTokenTicket did finish with data
// Return YES if you want to load the page, and NO if you don't.
NSLog(@"at return yes");
if (i==1) {
NSLog(@"returning no");
[webView removeFromSuperview];
return NO;
}
return YES;
}
i am sure that it is going to return no because the statement "returning no" is printed, but the control is not returned,i have given the statement NSLog(@"returned from web view delegate"); in the main function to know whether the control is returned it is not returned and also the operations below are not performed.