1

我正在尝试使用 FQL 语句获取用户名、pic_square 和状态对象:

使用 Graph API Explorer 效果很好。结果如下:

{
  "data": [
    {
      "uid": 657asdf, 
      "name": "Name1", 
      "pic_square": "http://profile.ak.fbcdn.net/hprofile-ak-snc7/371062_657477736_1asd.jpg", 
      "status": {
        "message": "who want's to bring me a burrito?", 
        "time": 1349381334, 
        "status_id": "1015110984sadf", 
        "comment_count": 0
      }
    }, 
    {
      "uid": 123asdf, 
      "name": "name2", 
      "pic_square": "http://profile.ak.fbcdn.net/hprofile-ak-snc6/275748_607345433_91234.jpg", 
      "status": {
        "message": "my excitement for tonight on a scale of 1-10 just went from a 15 to a 3 pretty quick", 
        "time": 1349386828, 
        "status_id": "1015216195asdf", 
        "comment_count": 0
      }
    }, 

但在 Xcode 中我得到以下结果,请注意状态为<null>

data =     (
                {
            name = "Name1";
            "pic_square" = "http://profile.ak.fbcdn.net/hprofile-ak-ash4/371941_803145_672321642_q.jpg";
            status = "<null>";
            uid = 801asdf;
        },
                {
            name = "Name2";
            "pic_square" = "http://profile.ak.fbcdn.net/hprofile-ak-ash4/276004_2403715_8811asdf.jpg";
            status = "<null>";
            uid = 240asdf;
        },

这是我从这里移植的代码

NSString *query =
    @"SELECT uid, name, pic_square, status FROM user WHERE (uid IN "
   @"(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 1055)) ORDER BY status.time";

    NSDictionary *queryParam =
    [NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];
    // Make the API request that uses FQL

    [FBRequestConnection startWithGraphPath:@"/fql"
                                 parameters:queryParam
                                 HTTPMethod:@"GET"
                          completionHandler:^(FBRequestConnection *connection,
                                              id result,
                                              NSError *error) {
                              if (error) {
                                  NSLog(@"Error: %@", [error localizedDescription]);
                              } else {
                                  NSLog(@"Result: %@", result);  

                              }
                          }];

这是 IOS Facebook API FBRequestConnection 方法的限制吗?有替代方法吗?我确信我不是唯一一个尝试在一个 FQL 查询中同时获取用户名和状态的人。

4

1 回答 1

0

It was user error. I did not set the appropriate permissioning to get the status. I had to include "frends_status" to the permissions array.

- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"user_likes",
                            @"read_stream",
                            @"friends_status",
                            nil];
于 2012-10-06T02:13:45.623 回答