views:

872

answers:

3

Hi everybody.

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

+6  A: 

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.

Jasarien
Ow yeah !It seems to work !It's so simple, that deconcerting.Thanks for the advice ;)
Martin
Where do you get the session instance from? (In other words, where does myFBSession come from?)
Greg Maletic
You create it yourself.
Jasarien
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
Yeah, that's right. Use `fbSession = [[FBSession sessionForApplication:[fbKeys apiKey] secret:[fbKeys secretKey] delegate:self] retain];`
Jasarien
A: 

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.

Tim A
A: 

[myFBSession resume];

This logic is helping for my application.

Thanks

Sathish