简体   繁体   中英

Facebook SDK Login dialog appears twice

In my project is the next code which sends some message to user feed:

[facebook authorize:permissions delegate:self];
[facebook dialog:@"feed" andParams:params andDelegate:self];

But when I call function with this code, login dialog appears twice. How can I solve this problem? Thanks

Login dialog is not appearing twice. Two Login dialogs are appearing at the same time . Both the above lines will open a dialog. So if you call those lines together, two dialogs will be opened together. If you are not already logged in to Facebook , obviously both the dialogs will open the Login page.

First, call

[facebook authorize:permissions delegate:self];

Once you logged in and the authorization is over, call

[facebook dialog:@"feed" andParams:params andDelegate:self];

Hii Paul:

You are calling FB Dialog two times - the First part this is login part when you have no fb session

[facebook authorize:permissions delegate:self];

When u invoke the first one, then you need to call this method to publish dialog in

- (void) fbDidLogin {
    [facebook dialog:@"feed" andParams:params andDelegate:self];
}

if u already have your FB Sesssion then you can directly call the second part:

[facebook dialog:@"feed" andParams:params andDelegate:self];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM