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

Self-Destructing Code Challenge Stage 2 HELP!

Challenge task 3 of 4 in Logging In and Logging Out:

The challenge asks to "add a call to the PFUser class method 'logInWithUsernameInBackground:password:block:'. Use "test" as both the username and password parameters. Then pass in 'loginHandler' as the third parameter."

This is what I wrote:

[PFUser loginWithUsernameInBackground:test password:test block:^(loginHandler)];

I tried to pass the block in so many ways, but I think i'm still missing something... any help would be appreciated!

3 Answers

When passing in blocks as variables, you do not need the ^( ... ), just use block:loginHandler.

Also, it is asking you to use NSStrings @"test" for both username and password. The variable test is not defined anywhere.

Hamish Jackson-Mee
Hamish Jackson-Mee
3,967 Points

Check your syntax, loginWithUsernameInBackground: login needs a capital I.

[PFUser logInWithUsernameInBackground:@"test" password:@"test" block:loginHandler];

Still not working... I tried as you suggested.

[PFUser loginWithUsernameInBackground:@"test" password:@"test" block:loginHandler];
[PFUser loginWithUsernameInBackground:(NSString *)@"test" password:(NSString *)@"test" block:loginHandler];

You only need the 1st line.