I am using the Facebook SDK for the first time. I am working with Xcode 5.1 and iOS 7.

I programmatically display FBLoginView:

```
- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"viewDidLoad");

    // Do any additional setup after loading the view.

    if ( !loginView ) {
       // loginView =[[FBLoginView alloc] initWithReadPermissions:@[@"basic_info"]];
        loginView =[[FBLoginView alloc] initWithReadPermissions:[NSArray arrayWithObjects:@"basic_info", @"user_location", nil]];
    }
    loginView.delegate = self;

    loginView.frame = CGRectOffset(loginView.frame,
                    (self.view.center.x -(loginView.frame.size.width /2)), 5);
    CGPoint vCenter   = CGPointMake( CGRectGetMidX(self.view.frame),
                                   CGRectGetMidY(self.view.frame) );
    CGPoint lvCenter  = CGPointMake( vCenter.x, vCenter.y+100.0 );
    loginView.center = lvCenter;
    [self.view addSubview:loginView];

    [self updateView];
}

```

I have implemented the required override functions:

```
#pragma mark - FBLoginViewDelegate

- (void) loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
    NSLog(@"loginViewFetchedUserInfo");

     [self updateView];

}
- (void) loginViewShowingLoggedInUser:(FBLoginView *)loginView {
    NSLog(@"loginViewShowingLoggedInUser");

    [self updateView];

}
- (void) loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
    NSLog(@"loginViewShowingLoggedOutUser");

     [self updateView];
}

- (void)updateView {
    NSLog(@"FB updateView");
    [[FBRequest requestForMe] startWithCompletionHandler:
     ^(FBRequestConnection *connection, NSDictionary<FBGraphUser>*FBUser, NSError *error) {
         if (error) {
             NSLog(@"updateView - error");
         } else {
             NSLog(@"updateView - good");
             NSNumber    *owner_id  = [NSNumber numberWithLong:[[FBUser id] longLongValue]];
             if ( FB_user_id == nil ) {
                 FB_user_id = owner_id;
                 NSLog(@"FBUser ID  = %@", FB_user_id);

                 loggedInSession = [FBSession activeSession];
                 [[NSUserDefaults standardUserDefaults] setObject:[FBUser id] forKey:@"eventOwnerID"];
                 [self performSegueWithIdentifier:@"continue_to_app" sender:self];
             }
         }
     }];
    if ([self checkFacebookSession]) {
    }
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.view setNeedsDisplay];
    });
}

```

The FBLoginView button appears with "Log in with Facebook". I can log in and accept permissions, but the loginViewShowingLoggedInUser override function never gets called.

Someone suggested adding the following:

```
- (BOOL) application:(UIApplication *) application 
                openURL:(NSURL *)url 
                sourceApplication:(NSString *)sourceApplication 
                annotation:(id)annotation 
{
    NSLog ( @"application openURL");
    NSLog ( @"URL = %@", url);
    NSLog ( @"Application = %@", sourceApplication);
    // Call FBAppCall's ha
    BOOL wasHandled = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
    //[LoginUIViewController updateView];

    return wasHandled;
}

```

This code had no effect and was never executed.

What am I doing wrong?