Home FBLoginViewDelegate methods are never called when I log in
Reply: 1

FBLoginViewDelegate methods are never called when I log in

Katedral Pillon
Katedral Pillon Published in 2015-03-05 18:22:04Z

I have a ViewController with a button

@property (weak, nonatomic) IBOutlet FBLoginView *loginButton;

In ViewDidLoad I set the delegate of the button

self.loginButton.delegate = self;

and then I implement the delegate methods

- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {

- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {

Naturally when I click on the login button it takes me through the Facebook login process. The problem is, when Facebook returns to my app, the delegate methods are not called. Yet when I look on https://www.facebook.com/settings?tab=applications I see that I have logged in.

So how do I get the delegate methods to be invoked? And yes I have the declaration

@interface MyFacebookViewController : UIViewController <FBLoginViewDelegate>
DanielG Reply to 2015-03-05 18:56:33Z

From the Facebook documentation, you need to call the Facebook URL handler from your application:openURL:sourceApplication:annotation: in your app delegate.

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

    // Call FBAppCall's handleOpenURL:sourceApplication to handle Facebook app responses
    BOOL wasHandled = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];

    // You can add your app-specific url handling code here if needed

    return wasHandled;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.296595 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO