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
With Facebook's iOS SDK version 3 out, the original answer no longer applies to the current version.
I had to do some digging, because the new version doesn't make this any easier. I found an example of how to get this done in the FBGraphObjectPagingLoader class that the new SDK provides to help do this for tables. It's incredibly ugly, but I assume that it's the "recommended" method since it's what they use.
Here's my slight modification of their code (found originally in FBGraphObjectPagingLoader's followNextLink method)
FBRequest *request = [[[FBRequest alloc] initWithSession:FBSession.activeSession graphPath:nil] autorelease];
FBRequestConnection *connection = [[[FBRequestConnection alloc] init] autorelease];
[connection addRequest:request completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
// Do some stuff
}];
// Override the URL using the one passed back in 'next'.
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url];
connection.urlRequest = urlRequest;
[connection start];
You could of course modify their library and encapsulate this in the class itself if you wanted to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With