2013-02-20 155 views
0

我想使用像给定链接中显示的按钮来使用网址。我们如何使用FB登录来访问URL?

At bottom Like button is there 点击喜欢按钮会喜欢这个页面,并显示在你的Facebook个人资料页面下活动块,如下图所示:

enter image description here

我们怎么能喜欢就好,在iPhone应用程序的URL。如果用户使用fb登录,那么就像不登录然后登录然后就像。

在此先感谢。

回答

1

最后,我都做到了。

代码喜欢网页URL中使用图形API如下:

- (IBAction)likepageonFB:(id)sender 
{ 
    [appDelegate openSession]; 

    NSString *[email protected]"http://www.facebook.com/ipreencekmr"; 

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            likePage, @"object",[[NSUserDefaults standardUserDefaults] valueForKey:@"token"],@"access_token", 
            nil]; 

    [FBRequestConnection startWithGraphPath:@"/me/og.likes" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { 

     UIAlertView *alert=[[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"liked with id %@",[result valueForKey:@"id"]] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; 
     [alert show]; 

     NSLog(@"result is %@",result); 
    }]; 
} 

您可以检查这个例子中,我已经上传FBLike Button