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
Jon Kolman
Courses Plus Student 4,132 PointsParse Sign In With Facebook Doesn't Work
Hello I am working on an app that uses the Parse Facebook Login and I have ran into a problem. How do I add the Facebook AUTH for login, and post something to the users Facebook wall bringing it to a test page. Right now it goes to the error alert that I made but I don't know how to fix it. Code:
#import "FBLoginViewController.h"
@interface FBLoginViewController () <CommsDelegate>
@property (nonatomic, strong) IBOutlet UIButton *btnLogin;
@property (nonatomic, strong) IBOutlet UIActivityIndicatorView *activityLogin;
@end
@implementation FBLoginViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void) viewDidLoad
{
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES];
// Ensure the User is Logged out when loading this View Controller
// Going forward, we would check the state of the current user and bypass the Login Screen
// but here, the Login screen is an important part of the tutorial
[PFUser logOut];
}
// Outlet for FBLogin button
- (IBAction) loginPressed:(id)sender
{
// Disable the Login button to prevent multiple touches
[_btnLogin setEnabled:NO];
// Show an activity indicator
[_activityLogin startAnimating];
// Do the login
[Comms login:self];
}
- (void) commsDidLogin:(BOOL)loggedIn {
// Re-enable the Login button
[_btnLogin setEnabled:YES];
// Stop the activity indicator
[_activityLogin stopAnimating];
// Did we login successfully ?
if (loggedIn) {
// Seque to the Image Wall
[self performSegueWithIdentifier:@"LoginSuccessful" sender:self];
} else {
// Show error alert
[[[UIAlertView alloc] initWithTitle:@"Error"
message:@"Registration failed. Please try again"
delegate:nil
cancelButtonTitle:@"Okay"
otherButtonTitles:nil] show];
}
}
@end
2 Answers
Jon Kolman
Courses Plus Student 4,132 PointsCan you please help me, Amit Bijlani?
Jon Kolman
Courses Plus Student 4,132 PointsI still could not get it working even after that, any other ideas? Could you possibly take a look at the project and find a fix? Amit Bijlani
Jon Kolman
Courses Plus Student 4,132 PointsI still could not get it working even after that, any other ideas? Could you possibly take a look at the project and find a fix? Amit Bijlani