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 Build a Self-Destructing Message iPhone App Using Parse.com as a Backend and Adding Users Logging In and Logging Out

Build a self destructing message 2 of 4

here is my code

#import "MainViewController.h"
#import "LoginViewController.h"
#import <Parse/Parse.h>

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    PFUser *currentUser;
     PFUser *currentUser = [PFUser currentUser];
    if (currentUser==nil ) {

        [self performSegueWithIdentifier:@"showLogin" sender:self];


    }


- (IBAction)logOut:(id)sender {

    [self performSegueWithIdentifier:@"showLogin" sender:self];
}

@end

1 Answer

Justin Horner
STAFF
Justin Horner
Treehouse Guest Teacher

Hello DeShawn,

In your code there are two variables by the name of currentUser. The challenge already gives you the currentUser variable so you only need to set it, like this.

PFUser *currentUser = [PFUser currentUser];

I hope this helps.