简体   繁体   中英

Tabbarcontroller is working in simulator not on iOS device

I have created a tab bar controller inside interface builder and i have created all the view controllers for each tab and the tabbarcontroller is embedded inside a navigation controller. everything is working fine in simulator, Tab bar items are all loaded and changing tabs is working too. Calling [self.viewControllers count]; inside tab bar controller returns the correct number of tab bar items eg 5.

But when i build the same project on iOS device (version 7.1) when the tab bar controller scene is called, it shows empty screen and no tab bar items are displayed in the bar. Calling [self.viewControllers count]; returns 0 indeed.

I can't figure out why the simulator is working as expected and iOS device is not.

This is how i get to the tab bar view controller with a push segue from another view controller :

- (void)viewDidLoad {
    [super viewDidLoad];
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if(![defaults boolForKey:@"isLoggedOut"])
    {
        dispatch_async(dispatch_get_main_queue(), ^(void){
            [self performSegueWithIdentifier:@"skipLogin" sender:self];
        });
    }
}

Try to a clean build and/or deleting you app form the Device. sometimes more than one version installed in the device if I changed the app id or something Xcode launch the wrong one in the Device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM