Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Trent Burkenpas](https://uploads.teamtreehouse.com/production/profile-photos/58944/micro_DSC05411.jpg)
Trent Burkenpas
22,388 PointsHere we go again! The Ribbit app
soooooo...Im setting up the logging in and out for the Ribbit app. I have 2 Problems. When I log in and then end the simulator, then run it again, I have to sign in again. But it should stya logged in for me until I log out. another issue is when i do log in i get this error message
Ribbit[9500] <Error>: CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
This Ribbit app is going to be the death of me!
Thankfs for the help!
4 Answers
![Stone Preston](https://secure.gravatar.com/avatar/c2b2872f48c222732218df9be85e1ed2?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Stone Preston
42,016 Pointshere is your issue:
PFUser *currentUser = [PFUser currentUser];
if (currentUser) {
NSLog(@"Current user: %@", currentUser.username);
}
else {
[self performSegueWithIdentifier:@"showLogin" sender:self];
}
//this line runs no matter what, even if the user is already logged in. You dont want this
[self performSegueWithIdentifier:@"showLogin" sender:self];
notice how in your else block you perform the showLogin segue, then after that else block your perform the showLogin segue regardless if the user is logged in or not? Basically the if/else block runs, then no matter what the showLogin segue is performed. Try removing that last line so you have
PFUser *currentUser = [PFUser currentUser];
if (currentUser) {
NSLog(@"Current user: %@", currentUser.username);
}
else {
[self performSegueWithIdentifier:@"showLogin" sender:self];
}
![Stone Preston](https://secure.gravatar.com/avatar/c2b2872f48c222732218df9be85e1ed2?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Stone Preston
42,016 Pointsin regards to the CGContext error, i got that as well, and from what I could find on stack overflow its a bug with ios 7/several ios 7 controls. You can just google the error and find several posts about it. here is one of the posts im referencing
your right about the sign in. You should only have to sign in once. Please post the code for your inbox view controller, specifically your view did load method where you check to see if a user is signed in.
![Trent Burkenpas](https://uploads.teamtreehouse.com/production/profile-photos/58944/micro_DSC05411.jpg)
Trent Burkenpas
22,388 PointsOK thank you !
- (void)viewDidLoad
{
[super viewDidLoad];
PFUser *currentUser = [PFUser currentUser];
if (currentUser) {
NSLog(@"Current user: %@", currentUser.username);
}
else {
[self performSegueWithIdentifier:@"showLogin" sender:self];
}
[self performSegueWithIdentifier:@"showLogin" sender:self];
}
![Trent Burkenpas](https://uploads.teamtreehouse.com/production/profile-photos/58944/micro_DSC05411.jpg)
Trent Burkenpas
22,388 Pointsohhhh i seel. Thanks!