سؤال

Might be that is is already answered and that i am searching wrong or something.

I am trying to display the main feed of the logged in facebook user in iOS via the social framework.

First i get all the recent posts

SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:@"https://graph.facebook.com/me/home" parameters:parameters];
[request setAccount:account];

I then receive the post. But they also contain stories like

{
"created_time" = "2013-10-17T11:25:51+0000";
from =     {
    id = --------;
    name = "--------";
};
id = "------------";
likes =     {
    data =         (
    );
    paging =         {
        cursors =             {
            after = MTAwMDAwNzQ4MjE0NjIw;
            before = MTAwMDAyMTkxODc3MDQw;
        };
    };
};

privacy =     {
    value = "";
};
story = "--------- likes a link.";
"story_tags" =     {
    0 =         (
                    {
            id = -----------;
            length = 14;
            name = "----------";
            offset = 0;
            type = user;
        }
    );
};
type = status;
"updated_time" = "2013-10-17T11:25:51+0000";
}

Then i try to get the details of this post

NSString *url = [NSString stringWithFormat:@"https://graph.facebook.com/%@", postId];

SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:url] parameters:parameters];
[request setAccount:account];

for the post id i use the id value from the rootdoc (not the one of the from, or story_tags section).

When i do that i get an error

{message=Unsupported get request., type=GraphMethodException, code=100}

The permissions i request from the user are

+ (NSDictionary *)facebookOptions
{
NSArray *permissions = @[@"read_stream", @"email", @"publish_stream", @"status_update", @"share_item", @"user_friends", @"publish_actions"];

return @{
         ACFacebookAppIdKey         : FACEBOOK_APP_ID,
         ACFacebookPermissionsKey   : permissions,
         ACFacebookAudienceKey      : ACFacebookAudienceEveryone
         };
}

Can anyone explain me if and if so how you get the details of those post? I mean in the direct post to the wall (not sharing, liking, linking, etc) you get something with a message tag, image url etc.

Kind regards

Saren

هل كانت مفيدة؟

المحلول

It seems i made a mistake with the account, the details request used a nil account. After fixing it i discovered that you can get the original post id from the actions or the root id.

The root id has something like xxxxxxxxxx_yyyyyyyyyy where the yyyyyyyyyy part is the original post id.

The actions have an url like https://www.facebook.com/xxxxxxxxxx/posts/yyyyyyyyyy for the posts.

The yyyyyyyyyy part here is also the original post.

Kind regards and thanks for the people who have read this question and give it a second or more to think about ;)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top