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

  • SEARCH
  • Home
  • 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 1070341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:32:47+00:00 2026-05-16T20:32:47+00:00

How to call main thread ??? i can parse but i cant display data

  • 0

How to call main thread ??? i can parse but i cant display data

- (void)viewDidLoad {
    //self.navigationItem.rightBarButtonItem = self.editButtonItem;
    self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"10.png"]];
    [super viewDidLoad];
  [NSThread detachNewThreadSelector:@selector(startTheBackgroundJob) toTarget:self withObject:nil]; 

      }


- (void)startTheBackgroundJob {  


    NSUserDefaults *getida = [NSUserDefaults standardUserDefaults];

        myIDa = [getida stringForKey:@"AppID"];

        NSLog(@"@BOOK MARK ");



        NSString *ubook = [[NSString alloc] initWithFormat:@"http://www.wapp=%@&action=show",myIDa];
        NSLog(@" bookmark %@",ubook);
        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
        //NSString *outputString = [[NSString stringWithString:usearch] stringByAppendingString: UserText];
        ubook = [ubook stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


        NSLog(@"My string is  now =  %@", ubook);

        NSURL *url = [[[NSURL alloc] initWithString:ubook]autorelease];
        //NSURL *url=   [NSURL URLWithString:outputString];

            NSLog(@" bookmark URL IS  %@",url);

        NSXMLParser *xmlParser = [[[NSXMLParser alloc] initWithContentsOfURL:url] autorelease];

        //Initialize the delegate.
        XMLParserbookm *parser = [[[XMLParserbookm alloc] initXMLParser]autorelease];

        //Set delegate
        [xmlParser setDelegate:parser];

        //Start parsing the XML file.
        BOOL success = [xmlParser parse];
        if(success)
        {

            NSLog(@" xml parsed suucess");

            //[super viewDidLoad];

            [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;


            //[self searchTableView];   
            //mytimer4=[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(wipe) userInfo:nil repeats:NO];
        }

        else{
            NSLog(@"eeror");
        }
        [NSThread sleepForTimeInterval:3];  
    [self performSelectorOnMainThread:@selector(makeMyProgressBarMoving) withObject:nil  waitUntilDone:NO];   // HOW TO CALL MAIN THREAD
    [pool release]

}
  • 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-16T20:32:48+00:00Added an answer on May 16, 2026 at 8:32 pm

    You can try with

    • viewDidAppear:, this method is called after you go to a new view. Then at least, you can switch to new view, you should make sure that there is something on the screen in waiting for the xml parsing

    • Using Thread: You put parsing into another thread and then callback your main thread after you finish, then there will be no block at all

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I can't call lock on a mutex in the main application thread (my
Possible Duplicate: Can main function call itself in C++? I found this problem very
In my main(String[] args) method I have naught but a call to SwingUtilities.invokeAndWait to
I have 2 classes 'Main' and 'FOR'. From 'Main' I will call method 'display'
I'm puzzling over how multithreading can work with delegates. The main thread has an
How can I get NSURLConnection to call it's delegate methods from a different thread
The reference says this: You should call this function from the main thread of
I have a boost based thread(let's call it T-thread) separate from the iphone's main
Does UIView's -drawRect: method have to be drawn on the main thread or can
I want call a function which makes my main thread stuck using the above

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.