I have an app that starts out in the login screen and when you log in it pushes a modal TabBarController. One of the tabs is settings which has a logout button, what would be the correct way to log out of my app and not have any issues such as memory leaks?
Asked
Active
Viewed 701 times
1
-
Try to be more specific. – Nick Weaver Mar 20 '12 at 14:58
-
I mean, should I just pop the TabBarController? Release it for the app to go back to the login screen? Dismiss the modal it's in, or what? – 8vius Mar 20 '12 at 15:11
2 Answers
1
It really depends on how your users are logging in. What you probably need to do is the opposite of whatever you are doing to login. If all the login does is open the modal dialog, then closing it should be fine. It you are setting some kind of security token, then you will need to set it to nil.
Without knowing more about how your app works, there isn't much more I can say.

Barlow Tucker
- 6,229
- 3
- 36
- 42
-
1It's just the returning to the Login view that's the issue, the rest is pretty much irrelevant. I know I can get the TabBarController's presenting view and dismiss it, but won't this cause memory leaks or anything of the sort? Just uprooting the controller like that? – 8vius Mar 20 '12 at 15:46
0
I know this is old, but if you want to present your login screen (because you logged out) as a modal, you can do this:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
//Your login view controller, make sure you set the storyboard id
TTTLoginController *log = (TTTLoginController *)[storyboard instantiateViewControllerWithIdentifier:@"log"];
//wrap it in a navigation controller
UINavigationController *navBar=[[UINavigationController alloc]initWithRootViewController:log];
//present the modal view
[self.navigationController presentViewController:navBar animated:YES completion:nil];

mnearents
- 646
- 1
- 6
- 31