I am using this code to share an item on Facebook newsfeed:
-(void)recommendOnFacebook:(Item *)currentItem{
if(!facebook){
facebook = [[Facebook alloc] initWithAppId:@"myappid" andDelegate:self];
}
NSMutableDictionary *params2 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"%@", currentItem.name], @"name",
[shop name], @"caption",
currentItem.description, @"description",
[NSString stringWithFormat:@""], @"link",
currentItem.imagePath, @"picture",
nil, @"actions",
nil];
[facebook dialog:@"feed"
andParams:params2
andDelegate:self];
}
If I am logged in, I can successfully see the dialog to share the feed. But if I am not logged in, after this code block finishes, api dialog asks for my credentials. What I need is, if the user is not logged in, api shows the dialog, after the user successfully logs in, another dialog is shown to continue sharing progress.
You need to take a look at FBSessionDelegate. Here is my code for sharing
EDIT
For logout in cases of public cafe you need to make sure that u NEVER save access token in NSUSerDefaults as in FB Session delegate method fbDidLogin
Now implements FBDialogDelegate method