views:

31

answers:

1

hello

I am using Facebook in my music application where user post comment on wall paper after listening the songs . So problem arises that user have to login again for next song. so please provide me code for session retains when he clicked on the tab where it written "keep me login".

Thanks

A: 

I have a file called FacebookHelper.m, here is the code there:

- (id)init {
    if (self = [super init]) {
        session_ = [[FBSession sessionForApplication:kAPIKey secret:kApplicationSecret delegate:self] retain];
        [session_ resume];      
    }
    return self;
}

If you want to control the login dialog yourself, here is the code:

- (void)loginByShowingDialog {
    self.isDialogShown = YES;
    FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:self.session] autorelease];
    dialog.delegate = self;
    [dialog show];
}

For your cases, I think you only need to get the session back and resume it.

vodkhang
thankx for u r answer but the problem is that the facebook dialog box opens automatically without clicking on the facebook icon
What facebook dialog box? The code that I posted or your code? Can you show me some code. It is better
vodkhang
publish page is open automatically after using above code foe session retain .Even you are providing to control login dialog
yeah, it is just to control the login dialog. Which facebook dialog box are you talking about? I think you talked about facebook login diaglog box, right?
vodkhang
yes, you are right but when i use 2nd part code then for the line "self.is dialogShown = yes; come error like "isDialogShown" is not structure or union. please help me to remove this error Secondly there is one warning 'FBDialogDelegate protocol' does not implemented by my controoler in which i used this code . so please help me
ah, sorry. The posted code comes from my application. you can declare a BOOl isDialogShown in your interface or just delete that line. Your interface must conform to the FBLoginDialogDelegate to show it
vodkhang
all the error are solved but page which is post to wall is open automatically when i go back to menu and see the facebook icon. can i post whole code in next question. or you will understood what i am said
yeah, you should do that. Don't forget to come back to your question list and accept some
vodkhang
please check i am included with code to next question as "session problem with facebook
thank u so much