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

Alexander Teague
Alexander Teague
9,501 Points

Login Code Challenge 2/4

Hi i can't find why this won't validate, if an object isn't returned for current user show login view is what i thought i wrote but it won't work?

This is my code.

import "MainViewController.h"

import "LoginViewController.h"

import <Parse/Parse.h>

@implementation MainViewController

  • (void)viewDidLoad { [super viewDidLoad];

    PFUser *currentUser = [PFUser currentUser];

if ([currentUser == nil]){ [self performSegueWithIdentifier:@"showLogin" sender:self];}; };

  • (IBAction)logOut:(id)sender {

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


Alexander Teague
Alexander Teague
9,501 Points

Solved it now, i put square brackets where it should have just been if (currentUser == nil) {

// perform segue