I’m using the below code in my app delegate to send the user to the right view controller:
BOOL user = [[NSFileManager defaultManager] fileExistsAtPath:userFile];
NSString *identifier = user ? @"in" : @"out";
UIStoryboard *storyBoard = [[self.window rootViewController] storyboard];
UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:identifier];
[self.window setRootViewController:viewController];
Now I’m trying to use the code in the sign in view controller, but I don’t have self.window reference, so the code doesn’t work. How can I send the user to a specific view controller?
It’s the views that hold a reference to the window, not the controllers. Try
self.view.windowinstead.