Facebook的FB Graph API身份验证

时间:2012-06-09 09:41:15

标签: iphone objective-c xcode fb-graph

我使用FB graph api将我的ios应用程序与facebook集成。但登录时 弹出webview,第一个问题是它没有取消按钮 我仍然按下一个按钮应用一个动作,但无法从我来的地方进入那个屏幕。

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 = 0;
UIWebView *aWebView = [[UIWebView alloc] initWithFrame:webFrame];
[aWebView setDelegate:self];    
self.webView = aWebView;

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(5.0, 10, 150.0, 30.0);
[button setTitle:@"My Button" forState:UIControlStateNormal];
[button addTarget:self action:@selector(myAction:) forControlEvents:UIControlEventTouchUpInside];
[self.webView addSubview:button];
[aWebView release];

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

所以我怎么能回来请一些身体帮助我......

2 个答案:

答案 0 :(得分:0)

myAction:方法中,移除webView

[self.webView removeFromSuperView];

答案 1 :(得分:0)

我认为您应该浏览此链接http://www.raywenderlich.com/1488/how-to-use-facebooks-new-graph-api-from-your-iphone-app,以便找到取消按钮未来的原因,希望它有所帮助。