objective-ciphonefacebookfacebook-graph-apiwebview

Facebook Graph API for iPhone -- Cancel Button Error


I'm currently using the Facebook Graph API to log a user in and post to their wall... which works great. The issue I'm having is for the user that wants to retreat... and not log in. Basically, the "Cancel" button next the the "Login" button in the webView doesn't work properly (Facebook's fault) and I'm forced to include a "Close" button on the bottom.

Here is my problem: My code that opens the login webView seems to override anything I have in the .xib. My "Close" button I want to include at the bottom will not appear. Any idea why?

Currently (from an existing tutorial), the Facebook login is appearing with the following code:

- (void)authenticateUserWithCallbackObject:(id)anObject andSelector:(SEL)selector andExtendedPermissions:(NSString *)extended_permissions andSuperView:(UIView *)super_view {

    self.callbackObject = anObject;
    self.callbackSelector = selector;

    NSString *url_string = [NSString stringWithFormat:@"https://graph.facebook.com/oauth/authorize?client_id=%@&redirect_uri=%@&scope=%@&type=user_agent&display=touch", facebookClientID, redirectUri, extended_permissions];
    NSURL *url = [NSURL URLWithString:url_string];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];

    CGRect webFrame = [super_view frame];

    webFrame.origin.y = 20;
    UIWebView *aWebView = [[UIWebView alloc] initWithFrame:webFrame];
    [aWebView setDelegate:self];    
    self.webView = aWebView;

    [webView loadRequest:request];  
    [super_view addSubview:webView];

}

Thanks so much!


Solution

  • I figured out what I needed to do. I programmatically added a UIButton and connected it to an IBAction.

    All fixed!