Async call Objective C iphone

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-04-25T15:41:01Z Indexed on 2010/04/25 15:43 UTC
Read the original article Hit count: 281

Hi guys,

I'm trying to get data from a website- xml. Everything works fine.

But the UIButton remains pressed until the xml data is returned and thus if theres a problem with the internet service, it cant be corrected and the app is virtually unusable.

here are the calls:

{
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    if(!appDelegate.XMLdataArray.count > 0){
        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
        [appDelegate GetApps]; //function that retrieves data from Website and puts into the array - XMLdataArray.

    }
    XMLViewController *controller = [[XMLViewController alloc] initWithNibName:@"MedGearsApps" bundle:nil];
    [self.navigationController pushViewController:controller animated:YES];
    [controller release];
}

It works fine, but how can I make the view buttons functional with getting stuck. In other words, I just want the UIButton and other UIButtons to be functional whiles the thing works in the background.

I heard about performSelectorInMainThread but i cant put it to practice correctly

any help is appreciated :)

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone