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

iOS

Code challenge Logging in and Logging out 4 of 4

Finally, switch back to MainViewController.m. In the logout method, before the Login view controller segue is performed, add a call to Parse to logout the current user. Hint: Use the PFUser class method.

I thought the following code would work, since I pulled it straight from the video:

- (IBAction)logout:(id)sender {
    [PFUser logOut];
    [self performSegueWithIdentifier:@"showLogin" sender:self];
}

It's basically an addition of only one line... the logOut line.

Why doesn't this work?

UPDATE: It doesn't work because I think it's a bug in the code challenge. If you use "logout" (all lowercase), it works.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Ugh - so sorry about that! I stubbed out the PFUser class so we don't have to actually contact Parse from our Code Challenge engine. As such, I made a typo. I will fix it and update it now. :smile:

Elizabeth Fawkes, can you reward Masao with the Exterminator badge?

3 Answers

Tagging Amit Bijlani on this one

Ok, cool... Ben Jakuben is the author of the tutorial (not sure if this matters)

I forgot that Ben Jakuben did the newest iOS course, oops. Thanks for the correction.

It still doesn't work for me both on whether I am use "logout" or "logOut"

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Can you paste in the code you are trying?

Bummer! Compilation Error! Make sure your syntax is correct and that you are calling the 'logOut' method from the correct place. I tried both logout and logOut.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Can you paste in the code you are trying? I just got it to pass. Are you using PFUser?