Last active
August 29, 2015 14:01
-
-
Save marothstein/eb2ea19762f0e898fb4a to your computer and use it in GitHub Desktop.
login view controller situation - do I need a custom delegate?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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