Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 854319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:54:26+00:00 2026-05-15T07:54:26+00:00

Ok, I really spend 2 days on this and it has gotten me stumped.

  • 0

Ok, I really spend 2 days on this and it has gotten me stumped.

From my main UIViewController I called a WebViewController which is a UIViewController with a UIWebView inside:

UOLCategoriesWebViewController *ucwvcontroller = [[UOLCategoriesWebViewController alloc] initWithNibName:@"UOLCategoriesWebViewController" bundle:nil];

    [self presentModalViewController:ucwvcontroller animated:YES];
    [ucwvcontroller release];

Inside the UOLCategoriesWebViewController I’ve call the delegate method shouldStartLoadWithRequest where when the user clicks on a particular type of link it parses out the params and return back to the main UIViewController (or at least that’s what I want it to do):

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
    BOOL continueOrExit = YES;
    NSURL *url = request.URL;
    NSString *urlString = [url relativeString];
    NSString *urlParams = [url query];
    NSArray *urlParamArr = [urlParams componentsSeparatedByString:@"&"];
    NSLog(@"the url is: %@",urlString);
    //NSLog(@"the params are: %@,%@",[urlParamArr objectAtIndex:0],[urlParamArr objectAtIndex:1]);

    //BOOL endTrain1 = [[urlParamArr objectAtIndex:1] hasPrefix:@"subCatValue"];
    //BOOL endTrain2 = ([urlParamArr objectAtIndex:1
    //NSLog(@"Number of elements: %@",[urlParamArr count]);
    if (navigationType == UIWebViewNavigationTypeLinkClicked)
    {
        //NSLog(@"Enter into His glory");

        if ([urlString hasSuffix:@"categories_list.php"]) {

            //NSLog(@"2nd Heaven");
            continueOrExit = YES;

        }else if ([[urlParamArr objectAtIndex:1] hasPrefix:@"subCatValue"]) {
            continueOrExit = NO;
            NSLog(@"end of the train");
            NSArray *firstParamStringArr = [[urlParamArr objectAtIndex:0] componentsSeparatedByString:@"="];
            NSArray *secondParamStringArr = [[urlParamArr objectAtIndex:1] componentsSeparatedByString:@"="];
            NSString *catSelected = [firstParamStringArr objectAtIndex:1];
            NSString *subCatSelected = [secondParamStringArr objectAtIndex:1];



            //go back to native app
            [self goBackToMain:catSelected andSubCat:subCatSelected];



        }
    }
    return continueOrExit;
}

Actually in the above function where I am calling the goBackToMain method I want it to call the delegate method and return to the mainviewcontroller. Unfortunately after executing that goBackToMain method it goes back to this method and continue to return continueOrExit.

Is there anyway to make it truly exit without returning anything? I’ve tried putting in multiple returns to no avail. Or can I in the html page pass some javascript to directly call this method so that I don’t have to go through this delegate method?

Thanks for the help in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:54:26+00:00Added an answer on May 15, 2026 at 7:54 am

    What you can try is to defer the invocation of goBackToMain:andSubCat: after the delegate method execution. This way, the delegate method can return and the invocation is then processed:

    NSArray *firstParamStringArr = [[urlParamArr objectAtIndex:0] componentsSeparatedByString:@"="];
    NSArray *secondParamStringArr = [[urlParamArr objectAtIndex:1] componentsSeparatedByString:@"="];
    NSString *catSelected = [firstParamStringArr objectAtIndex:1];
    NSString *subCatSelected = [secondParamStringArr objectAtIndex:1];
    
    NSMethodSignature *sig = [self methodSignatureForSelector:@selector(goBackToMain:andSubCat:)];
    NSInvocation *inv = [NSInvocation invocationWithMethodSignature:sig];
    [inv retainArguments];
    [inv setTarget:self];
    [inv setSelector:selector];
    [inv setArgument:&catSelected atIndex:2];
    [inv setArgument:&subCatSelected atIndex:3];
    [inv performSelector:@selector(invoke) withObject:nil afterDelay:0.0];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This has been killing me for two days now. I have a main Activity
This has been killing me for two days now. I have a main Activity
This might sound a silly question but I've really spend hours in trying to
I try to develop an application for smartTV. I spend my two days really
This has been bugging me for days; I'm trying to send a SOAP post
This has been perplexing me for a couple of days, so I decided to
I'm new in programming windows phone 7 but get really tired cuz i spend
This struck me as really weird behaviour and I spent a while checking for
Really my question has more to do with the server-side scrubbing of html that's
I've spent two days on this and I still can't find the cause of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.