Take the 2-minute tour ×

I'm currently trying to add a facebook functionnality to my iPhone game (Tikitic, on the appstore! :))

It seems to be quite easy to make a facebook connexion by invoking the FBLoginDialog dialog. But I would like, with a login and a pass saved in the userdefaults, connect automatically to my account.

Does it exist a methode like [fbsession loginWithName:@"mylog" andPass:@"mypass"] ?

Thanks a lot

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

You can call:

[myFBSession resume];

on your session instance. I think that the session details are persisted by the FBConnect code, and you don't have to worry about that.

Also, users won't be happy if you store their Facebook login details within your app without encrypting them. This is why the FBSession is used, so you don't have to save those details.

share|improve this answer
Ow yeah ! It seems to work ! It's so simple, that deconcerting. Thanks for the advice ;) –  Martin Jul 29 '09 at 11:05
Where do you get the session instance from? (In other words, where does myFBSession come from?) –  Greg Maletic Feb 9 '10 at 17:59
You create it yourself. –  Jasarien Feb 9 '10 at 19:53
Sure, but how do you create it? Do you call 'session = [FBSession sessionForApplication:secret:delegate:] and use the returned value? Or do you use the session that is passed to the delegate? (Sorry...I find this Facebook Connect API the most confusing I've ever seen.) –  Greg Maletic Feb 9 '10 at 21:38
Yeah, that's right. Use fbSession = [[FBSession sessionForApplication:[fbKeys apiKey] secret:[fbKeys secretKey] delegate:self] retain]; –  Jasarien Feb 9 '10 at 21:59
show 1 more comment

The previous answer seems wrong to me. You can resume a session if you haven't initiated one to begin with using the users id and password at some point.

share|improve this answer
add comment

Your Answer


