title: Check if logged in on ios facebook sdk 3.0
body: <p>I am using iOS facebook SDK 3.0. How can i check if the user is already logged in?</p>
  
  <p>I tried the line below but it does not work properly. It <strong>sometimes</strong> returns NO although I am logged in. Any suggestions?</p>
  
  <pre><code>if (FBSession.activeSession.isOpen == YES)
  {
    // post to wall else login
  }
  </code></pre>
  
  <p><strong>-- EDIT --</strong></p>
  
  <p>this is how I open my Facebook session:</p>
  
  <pre><code>NSArray *permissions = [[NSArray alloc] initWithObjects:
                          @"user_likes", 
                          @"read_stream",
                          @"publish_actions",
                          nil];
  return [FBSession openActiveSessionWithPermissions:permissions
                                        allowLoginUI:allowLoginUI
                                   completionHandler:^(FBSession *session,
                                                       FBSessionState state,
                                                       NSError *error) {
                                       [self sessionStateChanged:session
                                                           state:state
                                                           error:error];
                                   }];
  </code></pre>
  
  <p>The first time it needs login and so it works. If i try this while I am already logged in the FBSession.activeSession.isOpen returns NO.</p>