Skip to content

Instantly share code, notes, and snippets.

@marothstein
Last active August 29, 2015 14:01
Show Gist options
  • Save marothstein/eb2ea19762f0e898fb4a to your computer and use it in GitHub Desktop.
Save marothstein/eb2ea19762f0e898fb4a to your computer and use it in GitHub Desktop.
login view controller situation - do I need a custom delegate?
// 1. App starts
// 2. If user is not logged in, rootViewController presents loginViewController (Code below)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
// Now check for authentication
[self checkIfLoggedIn];
...
return YES;
}
...
- (void)checkIfLoggedIn {
NSString *authToken = [SSKeychain passwordForService:@"FinalCard-AuthClient" account:@"auth_token"];
if (authToken != nil) {
NSLog(@"Have a user with auth_token: %@", authToken);
FCLoginViewController *fvc =[[FCLoginViewController alloc] init];
[self.viewController.frontViewController presentViewController:fvc animated:YES completion:nil];
}
}
// 3. User logs in
// 4. loginViewController is unshown, and user returns to rootViewController
// QUESTION:
// How do I notify rootViewController that the user has logged in and then remove loginViewController?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment