且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何移动到Facebook的下一页使用iOS SDK的JSON响应?

更新时间:2022-12-03 20:05:39

所有你需要添加一个方法到Facebook子类或其本身

   - (void)requestWithURLString :( NSString *)fullURL 
和HttpMethod :( NSString *)httpMethod
andDelegate :((id< FBRequestDelegate>)delegate {
[self openUrl:fullURL params:nil httpMethod:httpMethod delegate:delegate];
}

ps第二个参数httpMethod可能总是@GET你可以省略它


In Facebook iOS SDK, I can ask for queries like this:

[_facebook requestWithGraphPath:@"me/feed" andDelegate:self];

But often Facebook will give a limited JSON response with a URL to be used to request to move to earlier dates, for example. So in the JSON response, I'll have:

data =     ( /*things here... status updates, photos, etc...*/
    );
paging =     {
        next = "https://graph.facebook.com/me/feed?sdk=ios&sdk_version=2&access_token= <something>&until=2010-12-04";
        previous = "https://graph.facebook.com/me/feed?sdk=ios&sdk_version=2&access_token=<something>&since=<something>";
    };

What I'm wondering is... How do I go to the previous URL? Does the SDK provide an interface to do this?

EDIT: If possible, I actually want answer with Graph API, as Facebook is currently deprecating the REST API.

BONUS: If anyone can explain the time format that's returned by Facebook. I have 2010-09-13T00%3A25%3A16%2B0000 as an example.

all what you need that add a method to the Facebook subclass or itself

- (void)requestWithURLString:(NSString *)fullURL
               andHttpMethod:(NSString *)httpMethod
                 andDelegate:(id <FBRequestDelegate>)delegate {
    [self openUrl:fullURL params:nil httpMethod:httpMethod delegate:delegate];
}

ps the second param "httpMethod" may be always @"GET" you can omit it