1

我可以Facebook使用我的本机应用程序登录。我已经使用Social Framework并想facebook使用Graph Api. 但我没有得到任何解决方案我应该在下一步做什么。谁能告诉我下一步该怎么做??提前致谢

4

1 回答 1

0

您可以使用以下方式请求 Facebook 好友:

[FBRequestConnection
     startForMeWithCompletionHandler:^(FBRequestConnection *connection,
                                       id<FBGraphUser> user,
                                       NSError *error)
     {
         if (!error)
         {
             NSString *urlString = [NSString
                                    stringWithFormat:@"https://graph.facebook.com/me?fields=id,name,friends.fields(id,name,picture),picture&access_token=%@",
                                    [[FBSession.activeSession accessToken] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
             NSURL *url = [NSURL URLWithString:urlString];
             NSLog(@"%@",url);
             ASIFormDataRequest *request1 = [ASIFormDataRequest requestWithURL:url];
             [request1 setRequestMethod:@"GET"];
             [request1 setTag:101];
             [request1 setDelegate:self];
             [request1 startAsynchronous];
         }
     }];

你会得到回应:

- (void)requestFinished:(ASIHTTPRequest *)request
{
    if (request.tag == 101){
        NSDictionary *response = [[request responseString] JSONValue];
    }
} 
于 2013-07-30T13:07:00.473 回答