iPhone 版 Facebook Graph API——取消按钮错误

发布于 2024-10-12 23:58:55 字数 1198 浏览 4 评论 0原文

我目前正在使用 Facebook Graph API 来让用户登录并发布到他们的墙上……效果很好。我遇到的问题是对于想要撤退的用户......而不是登录。基本上,webView 中“登录”按钮旁边的“取消”按钮无法正常工作(Facebook 的错误),我我被迫在底部添加一个“关闭”按钮。

这是我的问题:我打开登录 webView 的代码似乎覆盖了 .xib 中的任何内容。我想包含在底部的“关闭”按钮不会出现。知道为什么吗?

目前(来自现有教程),Facebook 登录信息显示为以下代码:

- (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];

}

非常感谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

︶ ̄淡然 2024-10-19 23:58:55

我知道我需要做什么。我以编程方式添加了一个 UIButton 并将其连接到一个 IBAction。

全部修好了!

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

All fixed!

缱倦旧时光 2024-10-19 23:58:55

我不确定您使用的是哪个教程,但我可以说这里提供的解决方案: https: //github.com/facebook/facebook-ios-sdk 应该可以轻松处理这个问题。

I'm not sure which tutorial you are using, but I can say that the solution provided here: https://github.com/facebook/facebook-ios-sdk should handle this issue with little complication.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文