Frage

I use facebook sdk 3.11 and use FBWebDialogs to share link and image. when i create action sheet :

-(void) showActionSheet:(id)sender{
    NSLog(@"Show action Sheset");
    UIActionSheet *shareAction = [[UIActionSheet alloc] initWithTitle:@"xx zz yy" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles: nil];
    NSString * accTitle ;
    if ([[FBSession activeSession]isOpen]) {
        //        accTitle =@"Logged as %@",[self fetchUserData];

        accTitle =[[NSString alloc]initWithFormat:@"Logged as :" ];
        [shareAction addButtonWithTitle:@"Logout"];
        [shareAction addButtonWithTitle:@"Share"];
    }else{
        accTitle =@"Not login";
        [shareAction addButtonWithTitle:@"Login"];

    }
    [shareAction addButtonWithTitle:@"CanCel"];
    [shareAction setCancelButtonIndex:shareAction.numberOfButtons-1];
    [shareAction setTitle:accTitle];
    //    [shareAction setBounds:CGRectMake(0, 0, 400, 400)];
    [shareAction showInView:self.view];
}

[[FBSession activeSession]isOpen] it alway return no , although i have login and share to facebook . How i check session use for FBWebdialg?

War es hilfreich?

Lösung

If you are currently logged into FB than the FBSession returns "no" there is some issue going on with token state and you should call openActiveSessionWithAllowLoginUI (the FB methods checking the states it returns).

if ([[FBSession activeSession]state])

Also, you might want to look into this for further detail on token management using Facebook SDK.

It's worth noting that the Social.framework for iOS is just as useful if content is to be shared only.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top