Login to facebook without using FBLoginButton - iPhone
Is it possible to start an FB session in an iPhone app without using the FBLoginButton? I would like to let the user login when they clic开发者_如何转开发k on a table row.
Thanks.
yes, it is possible. It is the way I do:
I have a class called FacebookHelper:
- (id)init {
if (self = [super init]) {
session_ = [[FBSession sessionForApplication:kAPIKey secret:kApplicationSecret delegate:self] retain];
[session_ resume];
}
return self;
}
- (void)loginByShowingDialog {
self.isDialogShown = YES;
FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:self.session] autorelease];
dialog.delegate = self;
[dialog show];
}
First, you init an instance of Facebook Helper then call loginByShowingDialog, then everything just works by handling delegate
精彩评论