iPhone 版 Facebook Graph API——取消按钮错误
我目前正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道我需要做什么。我以编程方式添加了一个 UIButton 并将其连接到一个 IBAction。
全部修好了!
I figured out what I needed to do. I programmatically added a UIButton and connected it to an IBAction.
All fixed!
我不确定您使用的是哪个教程,但我可以说这里提供的解决方案: 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.