I have an iPhone application in which I am testing in the applicationDidBecomeActive: that if the selected viewcontroller's rootview is there, then I want to call one webservice, otherwise not when I am coming from background to foreground I am taking the stack and checking it. But now even if I am in the rootview the webservice is not getting called. Can anybody help me on this?
Here is my code snippet:
- (void)applicationDidBecomeActive:(UIApplication *)application{
    NSLog(@"applicationWilssnd");
    if(tabBarController.selectedIndex==0)
    {
        NSArray *mycontrollers = self.tabBarController.viewControllers;
        NSLog(@"%@",mycontrollers);
        ///if([mycontrollers objectAtIndex:0]!=)
        ///[[mycontrollers objectAtIndex:0] popToRootViewControllerAnimated:NO];
        PinBoardViewController *pinvc=(PinBoardViewController*)[[mycontrollers objectAtIndex:0]topViewController] ;
        if([mycontrollers objectAtIndex:0]!=pinvc)
        {
        }
        else
        {
        [pinvc merchantnews];
        }
        mycontrollers = nil; 
      tabBarController.selectedIndex = 0;  
    }
}
`here the merchantnews is not getting called.
 
     
    