Hi I have integrated Facebook SDK for an iOS 6 app.The Facebook authentication & sharing works perfectly but there are no provision to close the FB Dialogue box.ie. When FB Dialogue box opens,it will be closed only after authentication success.No provision to close or navigate back.How can I make a close button.The code snippet I am using has been shown below.Thanks in Advance.
-(NSDictionary *)shareFacebook
{
NSDictionary *userInfo;
if (FBSession.activeSession.isOpen)
{
if (FBSession.activeSession.isOpen)
{
[self.closeButton setHidden:NO];
[FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection, id<FBGraphUser> user, NSError *error) {
NSUserDefaults *standardUserDefaults=[NSUserDefaults standardUserDefaults];
[standardUserDefaults setObject:user forKey:@"fbUserInfo"];
[self.manager authenticateUserUsingFB:[user objectForKey:@"email"]];
}];
}
}
else{
NSLog(@"fb session not active.");
[self openSessionWithAllowLoginUI:YES];
}
return userInfo;
}
- (void)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_photos",
@"publish_actions",
@"read_stream",
@"friends_photos",
@"email" ,nil];
[FBSession setActiveSession:[[FBSession alloc] initWithPermissions:permissions]];
[[FBSession activeSession] openWithBehavior:FBSessionLoginBehaviorForcingWebView
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
NSLog(@" state=%d",state);
if(FBSessionStateOpen)
{
[self shareFacebook];
}
}];
}