We need to change StartViewController. In our app StartViewController is in Login.h. Once login completed successfully, the following time there is no need to show Login.h. So We tried changing View in AppDelegate, like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[NSThread sleepForTimeInterval:3.0];
NSString *myString = [[NSUserDefaults standardUserDefaults]stringForKey:@"loginpin"];
if (myString.length != 0) {
NSLog(@"Select Items %@",myString);
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.loginViewController = (ViewController*)[ourStoryBoard instantiateViewControllerWithIdentifier:@"Main"];
self.window.rootViewController = self.loginViewController;
self.window.backgroundColor = [UIColor grayColor];
[self.window makeKeyAndVisible];
}
return YES;
}
But we get this message in console:
Application windows are expected to have a root view controller at the end of application launch
Then it's showing empty screen. Please guide me. What's wrong in code? Is there any other way to hide loginScreen once login is successful?
