Search code examples
iosfacebookfacebook-graph-apifacebook-ios-sdk

How to move to the next page in Facebook JSON response using iOS SDK?


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.


Solution

  • 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