2

I have a popular medicine app often used by med students and residents at the bedside. I incorporated the new FB SKD into my last updated which, when opened for the first time (and subsequently if not used for a few days), opens the native FB app then redirects to my app. Many customers have complained because the info within the app often needs to be looked up quickly (crashing patient).

Is it possible to set up my app so the user needs to click on a button within the app before connecting to FB? Thanks!

  • Maybe your bigger issue is that an app critical to patient care is connecting to Facebook... – ceejayoz Nov 09 '11 at 22:41
  • You could use [ShareKit](http://getsharekit.com/) – syclonefx Nov 10 '11 at 01:40
  • possible duplicate of [How to authorize user through a DIALOG with the NEW Facebook Connect iOS API?](http://stackoverflow.com/questions/5559061/how-to-authorize-user-through-a-dialog-with-the-new-facebook-connect-ios-api) – George Stocker Nov 10 '11 at 13:44

2 Answers2

0

I think you will need to make change to authorizeWithFBAppAuth method in facebook.m file of the SDK.

This SO has a suggestion for you.

Community
  • 1
  • 1
user523234
  • 14,323
  • 10
  • 62
  • 102
0

When you download the FB SDK you get a sample project. Compile and run it, and you should see a toggle button that allows user to login/logout. You've got the FB official images in that project, and the code behind it is pretty simple:

 
/**
 * Called on a login/logout button click.
 */
- (void)fbButtonClick:(id)sender {
    if (fbButton.isLoggedIn) {
        [self logout];
    } else {
        [self login];
    }
}

/**
 * Show the authorization dialog.
 */
- (void)login {
    [_facebook authorize:nil delegate:self];
    NSLog(@"Sas");


}

/**
 * Invalidate the access token and clear the cookie.
 */
- (void)logout {

    [_facebook logout:self];

}

You should also change the button's state in the FBAuth delegate methods (which you've already implemented) by calling a method similar to this one:


- (void)updateFbButtonAccordingToSessionStatus {

    //Check if session is valid and update button accordingly
    if ([self.facebook isSessionValid] == NO ) {

        fbButton.isLoggedIn = NO;
        [fbButton updateImage];


    }
    else {

        fbButton.isLoggedIn = YES;
        [fbButton updateImage];        

    }


}

Hope this helps.

nadavhart
  • 201
  • 3
  • 6