title: How to Display the Facebook login page when button is clicked
body: <p>I want to display display the Facebook login page in my app when the user is not signed-in yet. I'm using Facebook SDK for posting a status message on the users Facebook wall when the user allows the app.</p>
  
  <p>Heres the code:</p>
  
  <pre><code>if (FBSession.activeSession.isOpen) {
      // post to wall
      @try {
          [self postStatusMethod];
          [self dismissViewControllerAnimated:YES completion:nil];
      }
      @catch (NSException *exception) {
          NSLog(@"Error on posting to fb: %@", exception);
      }
      @finally {
  
      }
  } else {
      // try to open session with existing valid token
      NSArray *permissions = [[NSArray alloc] initWithObjects:
                              @"read_stream",
                              @"publish_actions",
                              nil];
      FBSession *session = [[FBSession alloc] initWithPermissions:permissions];
      [FBSession setActiveSession:session];
      if([FBSession openActiveSessionWithAllowLoginUI:NO]) {
          // post to wall
          @try {
              [self postStatusMethod];
              [self dismissViewControllerAnimated:YES completion:nil];
          }
          @catch (NSException *exception) {
              NSLog(@"Error on posting to fb: %@", exception);
          }
          @finally {
  
          }
      } else {
          // you need to log the user
          [self userLogin];
      }
  }
  </code></pre>
  
  <p>how do i create the userLogin function so that is will display this:</p>
  
  <p><img src="https://i.stack.imgur.com/VfS1s.png" alt="enter image description here"></p>
  
  <p>Then, go back to the same view controller. i am using Facebook sdk.</p>