【问题标题】:Get a users timeline from the Facebook API从 Facebook API 获取用户时间线
【发布时间】:2012-11-16 13:06:56
【问题描述】:

我目前正在使用这段代码从 Facebook 获取用户供稿:

FBRequest *friendsRequest = [FBRequest requestWithGraphPath:[NSString stringWithFormat:@"%@?fields=cover,first_name,last_name,relationship_status,feed", self.friendID] parameters:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"en_EN", @"locale", nil] HTTPMethod:nil];
    [friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
                                                  NSDictionary* result,
                                                  NSError *error) {

        postsArray = [[NSMutableArray alloc] initWithArray:[result valueForKeyPath:@"feed.data"]];
        [tableView reloadData];
        NSLog(@"Data found: %@", [result description]);
        NSLog(@"Posts: %i", postsArray.count);
           }];

但是,此“供稿”还包括“XXX 在他自己的帖子上”或“用户 A 喜欢帖子 B”之类的内容,我想获取用户发布的内容以及其他人发布到他的墙上的内容(例如,如果您访问 facebook.com 或 iOS 应用程序中的用户时间线)。那可能吗?如果不是,我怎样才能知道状态是“喜欢”还是“评论...”?

【问题讨论】:

    标签: objective-c ios facebook api


    【解决方案1】:

    为什么不使用 read_stream 权限和 FQL

    文档here

    您可以遍历结果并找到type 等于的位置:

    46 - Status update
    56 - Post on wall from another user
    

    【讨论】:

    • 谢谢,成功了。但是“类型”总是返回 null...FBRequest *fql = [FBRequest requestForGraphPath:@"fql"]; [fql.parameters setObject:[NSString stringWithFormat:@"SELECT post_id, viewer_id, app_id, source_id, updated_time, created_time, filter_key, attribution, actor_id, target_id, message, app_data, action_links, attachment, impressions, comments, likes, place, privacy, permalink, xid, tagged_ids, message_tags, description, description_tags, type FROM stream WHERE source_id=%@ LIMIT 50", self.friendID] forKey:@"q"];
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    • 1970-01-01
    • 2011-08-12
    • 1970-01-01
    • 2013-06-13
    • 2011-08-16
    相关资源
    最近更新 更多